Sort machine families in admin page.

This commit is contained in:
2019-05-18 21:00:07 +01:00
parent ef5b0d71bc
commit d1082cc4b9
5 changed files with 18 additions and 18 deletions

View File

@@ -54,7 +54,7 @@ namespace cicm_web.Areas.Admin.Controllers
public async Task<IActionResult> Index() public async Task<IActionResult> Index()
{ {
IIncludableQueryable<MachineFamily, Company> cicmContext = _context.MachineFamilies.Include(m => m.Company); IIncludableQueryable<MachineFamily, Company> cicmContext = _context.MachineFamilies.Include(m => m.Company);
return View(await cicmContext.ToListAsync()); return View(await cicmContext.OrderBy(m => m.Company.Name).ThenBy(m => m.Name).ToListAsync());
} }
// GET: Admin/MachineFamilies/Details/5 // GET: Admin/MachineFamilies/Details/5

View File

@@ -42,18 +42,18 @@
<h4>Machine family</h4> <h4>Machine family</h4>
<hr /> <hr />
<dl class="dl-horizontal"> <dl class="dl-horizontal">
<dt>
@Html.DisplayNameFor(model => model.Name)
</dt>
<dd>
@Html.DisplayFor(model => model.Name)
</dd>
<dt> <dt>
@Html.DisplayNameFor(model => model.Company) @Html.DisplayNameFor(model => model.Company)
</dt> </dt>
<dd> <dd>
@Html.DisplayFor(model => model.Company.Name) @Html.DisplayFor(model => model.Company.Name)
</dd> </dd>
<dt>
@Html.DisplayNameFor(model => model.Name)
</dt>
<dd>
@Html.DisplayFor(model => model.Name)
</dd>
</dl> </dl>
<form asp-action="Delete"> <form asp-action="Delete">

View File

@@ -41,18 +41,18 @@
<h4>Machine family</h4> <h4>Machine family</h4>
<hr /> <hr />
<dl class="dl-horizontal"> <dl class="dl-horizontal">
<dt>
@Html.DisplayNameFor(model => model.Name)
</dt>
<dd>
@Html.DisplayFor(model => model.Name)
</dd>
<dt> <dt>
@Html.DisplayNameFor(model => model.Company) @Html.DisplayNameFor(model => model.Company)
</dt> </dt>
<dd> <dd>
@Html.DisplayFor(model => model.Company.Name) @Html.DisplayFor(model => model.Company.Name)
</dd> </dd>
<dt>
@Html.DisplayNameFor(model => model.Name)
</dt>
<dd>
@Html.DisplayFor(model => model.Name)
</dd>
</dl> </dl>
</div> </div>
<div> <div>

View File

@@ -48,10 +48,10 @@
<thead> <thead>
<tr> <tr>
<th> <th>
@Html.DisplayNameFor(model => model.Name) @Html.DisplayNameFor(model => model.Company)
</th> </th>
<th> <th>
@Html.DisplayNameFor(model => model.Company) @Html.DisplayNameFor(model => model.Name)
</th> </th>
<th></th> <th></th>
</tr> </tr>
@@ -61,10 +61,10 @@
{ {
<tr> <tr>
<td> <td>
@Html.DisplayFor(modelItem => item.Name) @Html.DisplayFor(modelItem => item.Company.Name)
</td> </td>
<td> <td>
@Html.DisplayFor(modelItem => item.Company.Name) @Html.DisplayFor(modelItem => item.Name)
</td> </td>
<td> <td>
<a asp-action="Details" <a asp-action="Details"

View File

@@ -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.434</Version> <Version>3.0.99.435</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>