Sort USB Vendors.

This commit is contained in:
2019-11-17 22:32:50 +00:00
parent 8467abadba
commit 2c6dd08004
3 changed files with 5 additions and 13 deletions

View File

@@ -1,3 +1,4 @@
using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using DiscImageChef.Server.Models; using DiscImageChef.Server.Models;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
@@ -14,7 +15,7 @@ namespace DiscImageChef.Server.Areas.Admin.Controllers
public UsbVendorsController(DicServerContext context) => _context = context; public UsbVendorsController(DicServerContext context) => _context = context;
// GET: Admin/UsbVendors // GET: Admin/UsbVendors
public async Task<IActionResult> Index() => View(await _context.UsbVendors.ToListAsync()); public async Task<IActionResult> Index() => View(await _context.UsbVendors.OrderBy(v => v.Vendor).ThenBy(v => v.VendorId).ToListAsync());
// GET: Admin/UsbVendors/Details/5 // GET: Admin/UsbVendors/Details/5
public async Task<IActionResult> Details(int? id) public async Task<IActionResult> Details(int? id)

View File

@@ -42,12 +42,6 @@
<th> <th>
@Html.DisplayNameFor(model => model.Vendor) @Html.DisplayNameFor(model => model.Vendor)
</th> </th>
<th>
@Html.DisplayNameFor(model => model.AddedWhen)
</th>
<th>
@Html.DisplayNameFor(model => model.ModifiedWhen)
</th>
<th></th> <th></th>
</tr> </tr>
</thead> </thead>
@@ -61,12 +55,6 @@
<td> <td>
@Html.DisplayFor(modelItem => item.Vendor) @Html.DisplayFor(modelItem => item.Vendor)
</td> </td>
<td>
@Html.DisplayFor(modelItem => item.AddedWhen)
</td>
<td>
@Html.DisplayFor(modelItem => item.ModifiedWhen)
</td>
<td> <td>
<a asp-action="Details" asp-route-id="@item.Id" class="btn btn-primary">Details</a> <a asp-action="Details" asp-route-id="@item.Id" class="btn btn-primary">Details</a>
</td> </td>

View File

@@ -32,6 +32,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using Newtonsoft.Json; using Newtonsoft.Json;
@@ -51,7 +52,9 @@ namespace DiscImageChef.Server.Models
[Key] [Key]
public int Id { get; set; } public int Id { get; set; }
[DisplayName("Manufacturer ID"), DisplayFormat(DataFormatString = "0x{0:X4}")]
public ushort VendorId { get; set; } public ushort VendorId { get; set; }
[DisplayName("Manufacturer")]
public string Vendor { get; set; } public string Vendor { get; set; }
public DateTime AddedWhen { get; set; } public DateTime AddedWhen { get; set; }
public DateTime ModifiedWhen { get; set; } public DateTime ModifiedWhen { get; set; }