Use different way of showing MMC FEATURES.

This commit is contained in:
2019-11-13 00:29:48 +00:00
parent 30a8776016
commit 69cc41c3c7
4 changed files with 49 additions and 5 deletions

View File

@@ -16,7 +16,18 @@ namespace DiscImageChef.Server.Areas.Admin.Controllers
public MmcController(DicServerContext context) => _context = context;
// GET: Admin/Mmc
public async Task<IActionResult> Index() => View(await _context.Mmc.ToListAsync());
public IActionResult Index() => View(_context.Mmc.Where(m => m.ModeSense2AData != null).
Select(m => new MmcModelForView
{
Id = m.Id, FeaturesId = m.FeaturesId,
DataLength = m.ModeSense2AData.Length
}).ToList().
Concat(_context.Mmc.Where(m => m.ModeSense2AData == null).
Select(m => new MmcModelForView
{
Id = m.Id, FeaturesId = m.FeaturesId,
DataLength = 0
}).ToList()).OrderBy(m => m.Id));
// GET: Admin/Mmc/Details/5
public async Task<IActionResult> Details(int? id)

View File

@@ -1,4 +1,4 @@
@model IEnumerable<DiscImageChef.CommonTypes.Metadata.Mmc>
@model IEnumerable<MmcModelForView>
@{
Layout = "~/Areas/Admin/Views/Shared/_Layout.cshtml";
@@ -37,7 +37,13 @@
<thead>
<tr>
<th>
@Html.DisplayNameFor(model => model.ModeSense2AData)
@Html.DisplayNameFor(model => model.Id)
</th>
<th>
@Html.DisplayNameFor(model => model.FeaturesId)
</th>
<th>
@Html.DisplayNameFor(model => model.DataLength)
</th>
<th></th>
</tr>
@@ -47,7 +53,20 @@
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.ModeSense2AData)
@Html.DisplayFor(modelItem => item.Id)
</td>
<td>
@if (item.FeaturesId != null)
{
<a asp-action="details" asp-controller="MmcFeatures" asp-route-id="@item.FeaturesId" target="_blank">@Html.DisplayFor(modelItem => item.FeaturesId)</a>
}
else
{
@Html.DisplayFor(modelItem => item.FeaturesId)
}
</td>
<td>
@Html.DisplayFor(modelItem => item.DataLength)
</td>
<td>
<a asp-action="Details" asp-route-id="@item.Id" class="btn btn-primary">Details</a>

View File

@@ -0,0 +1,14 @@
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
namespace DiscImageChef.Server.Models
{
public class MmcModelForView
{
public int Id { get; set; }
[DisplayFormat(NullDisplayText = "none"), DisplayName("MMC FEATURES ID")]
public int? FeaturesId { get; set; }
[DisplayName("Response length (bytes)")]
public int DataLength { get; set; }
}
}