mirror of
https://github.com/claunia/marechai.git
synced 2025-12-16 19:14:25 +00:00
Implement delete page for document companies.
This commit is contained in:
@@ -83,7 +83,9 @@ namespace cicm_web.Areas.Admin.Controllers
|
|||||||
|
|
||||||
if(documentCompany == null) return NotFound();
|
if(documentCompany == null) return NotFound();
|
||||||
|
|
||||||
ViewData["CompanyId"] = new SelectList(_context.Companies.OrderBy(c => c.Name).Select(c => new {c.Id, c.Name}), "Id", "Name", documentCompany.CompanyId);
|
ViewData["CompanyId"] =
|
||||||
|
new SelectList(_context.Companies.OrderBy(c => c.Name).Select(c => new {c.Id, c.Name}), "Id", "Name",
|
||||||
|
documentCompany.CompanyId);
|
||||||
|
|
||||||
return View(documentCompany);
|
return View(documentCompany);
|
||||||
}
|
}
|
||||||
@@ -114,7 +116,9 @@ namespace cicm_web.Areas.Admin.Controllers
|
|||||||
return RedirectToAction(nameof(Index));
|
return RedirectToAction(nameof(Index));
|
||||||
}
|
}
|
||||||
|
|
||||||
ViewData["CompanyId"] = new SelectList(_context.Companies.OrderBy(c => c.Name).Select(c => new {c.Id, c.Name}), "Id", "Name", documentCompany.CompanyId);
|
ViewData["CompanyId"] =
|
||||||
|
new SelectList(_context.Companies.OrderBy(c => c.Name).Select(c => new {c.Id, c.Name}), "Id", "Name",
|
||||||
|
documentCompany.CompanyId);
|
||||||
|
|
||||||
return View(documentCompany);
|
return View(documentCompany);
|
||||||
}
|
}
|
||||||
@@ -124,7 +128,15 @@ namespace cicm_web.Areas.Admin.Controllers
|
|||||||
{
|
{
|
||||||
if(id == null) return NotFound();
|
if(id == null) return NotFound();
|
||||||
|
|
||||||
DocumentCompany documentCompany = await _context.DocumentCompanies.FirstOrDefaultAsync(m => m.Id == id);
|
DocumentCompanyViewModel documentCompany =
|
||||||
|
await _context.DocumentCompanies
|
||||||
|
.Select(d => new DocumentCompanyViewModel
|
||||||
|
{
|
||||||
|
Id = d.Id,
|
||||||
|
Name = d.Name,
|
||||||
|
Company = d.Company.Name,
|
||||||
|
CompanyId = d.CompanyId
|
||||||
|
}).FirstOrDefaultAsync(m => m.Id == id);
|
||||||
if(documentCompany == null) return NotFound();
|
if(documentCompany == null) return NotFound();
|
||||||
|
|
||||||
return View(documentCompany);
|
return View(documentCompany);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
@model Cicm.Database.Models.DocumentCompany
|
@model cicm_web.Areas.Admin.Models.DocumentCompanyViewModel
|
||||||
|
|
||||||
@{
|
@{
|
||||||
ViewData["Title"] = "Delete";
|
ViewData["Title"] = "Delete";
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
<h3>Are you sure you want to delete this?</h3>
|
<h3>Are you sure you want to delete this?</h3>
|
||||||
<div>
|
<div>
|
||||||
<h4>DocumentCompany</h4>
|
<h4>Document company</h4>
|
||||||
<hr />
|
<hr />
|
||||||
<dl class="row">
|
<dl class="row">
|
||||||
<dt class="col-sm-2">
|
<dt class="col-sm-2">
|
||||||
@@ -18,10 +18,13 @@
|
|||||||
@Html.DisplayFor(model => model.Name)
|
@Html.DisplayFor(model => model.Name)
|
||||||
</dd>
|
</dd>
|
||||||
<dt class="col-sm-2">
|
<dt class="col-sm-2">
|
||||||
@Html.DisplayNameFor(model => model.CompanyId)
|
@Html.DisplayNameFor(model => model.Company)
|
||||||
</dt>
|
</dt>
|
||||||
<dd class="col-sm-10">
|
<dd class="col-sm-10">
|
||||||
@Html.DisplayFor(model => model.CompanyId)
|
<a asp-action="Details"
|
||||||
|
asp-route-id="@Model.CompanyId"
|
||||||
|
asp-controller="Companies">
|
||||||
|
@Html.DisplayFor(modelItem => Model.Company)</a>
|
||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
@@ -30,7 +33,10 @@
|
|||||||
asp-for="Id" />
|
asp-for="Id" />
|
||||||
<input class="btn btn-danger"
|
<input class="btn btn-danger"
|
||||||
type="submit"
|
type="submit"
|
||||||
value="Delete" /> |
|
value="Delete" />
|
||||||
<a asp-action="Index">Back to List</a>
|
<a asp-action="Index"
|
||||||
|
class="btn btn-secondary">
|
||||||
|
Back to List
|
||||||
|
</a>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netcoreapp2.2</TargetFramework>
|
<TargetFramework>netcoreapp2.2</TargetFramework>
|
||||||
<Version>3.0.99.859</Version>
|
<Version>3.0.99.860</Version>
|
||||||
<Company>Canary Islands Computer Museum</Company>
|
<Company>Canary Islands Computer Museum</Company>
|
||||||
<Copyright>Copyright © 2003-2018 Natalia Portillo</Copyright>
|
<Copyright>Copyright © 2003-2018 Natalia Portillo</Copyright>
|
||||||
<Product>Canary Islands Computer Museum Website</Product>
|
<Product>Canary Islands Computer Museum Website</Product>
|
||||||
|
|||||||
Reference in New Issue
Block a user