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();
|
||||
|
||||
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);
|
||||
}
|
||||
@@ -114,7 +116,9 @@ namespace cicm_web.Areas.Admin.Controllers
|
||||
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);
|
||||
}
|
||||
@@ -124,7 +128,15 @@ namespace cicm_web.Areas.Admin.Controllers
|
||||
{
|
||||
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();
|
||||
|
||||
return View(documentCompany);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@model Cicm.Database.Models.DocumentCompany
|
||||
@model cicm_web.Areas.Admin.Models.DocumentCompanyViewModel
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Delete";
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
<h3>Are you sure you want to delete this?</h3>
|
||||
<div>
|
||||
<h4>DocumentCompany</h4>
|
||||
<h4>Document company</h4>
|
||||
<hr />
|
||||
<dl class="row">
|
||||
<dt class="col-sm-2">
|
||||
@@ -18,10 +18,13 @@
|
||||
@Html.DisplayFor(model => model.Name)
|
||||
</dd>
|
||||
<dt class="col-sm-2">
|
||||
@Html.DisplayNameFor(model => model.CompanyId)
|
||||
@Html.DisplayNameFor(model => model.Company)
|
||||
</dt>
|
||||
<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>
|
||||
</dl>
|
||||
|
||||
@@ -30,7 +33,10 @@
|
||||
asp-for="Id" />
|
||||
<input class="btn btn-danger"
|
||||
type="submit"
|
||||
value="Delete" /> |
|
||||
<a asp-action="Index">Back to List</a>
|
||||
value="Delete" />
|
||||
<a asp-action="Index"
|
||||
class="btn btn-secondary">
|
||||
Back to List
|
||||
</a>
|
||||
</form>
|
||||
</div>
|
||||
@@ -2,7 +2,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.2</TargetFramework>
|
||||
<Version>3.0.99.859</Version>
|
||||
<Version>3.0.99.860</Version>
|
||||
<Company>Canary Islands Computer Museum</Company>
|
||||
<Copyright>Copyright © 2003-2018 Natalia Portillo</Copyright>
|
||||
<Product>Canary Islands Computer Museum Website</Product>
|
||||
|
||||
Reference in New Issue
Block a user