Show tested media in device report details.

This commit is contained in:
2019-11-23 23:51:09 +00:00
parent 91d96f5402
commit 051547a4dd
4 changed files with 63 additions and 9 deletions

View File

@@ -78,6 +78,17 @@ namespace DiscImageChef.Server.Areas.Admin.Controllers
model.ReadCapabilitiesId =
model.Report.ATA?.ReadCapabilities?.Id ?? model.Report.SCSI?.ReadCapabilities?.Id ?? 0;
// So we can check, as we know IDs with 0 will never exist, and EFCore does not allow null propagation in the LINQ
int ataId = model.Report.ATA?.Id ?? 0;
int atapiId = model.Report.ATAPI?.Id ?? 0;
int scsiId = model.Report.SCSI?.Id ?? 0;
int mmcId = model.Report.SCSI?.MultiMediaDevice?.Id ?? 0;
model.TestedMedias = _context.TestedMedia.
Where(t => t.AtaId == ataId || t.AtaId == atapiId || t.ScsiId == scsiId ||
t.MmcId == mmcId).OrderBy(t => t.Manufacturer).
ThenBy(t => t.Model).ThenBy(t => t.MediumTypeName).ToList();
return View(model);
}

View File

@@ -384,4 +384,45 @@
</tbody>
</table>
</div>
}
@if (Model.TestedMedias.Count > 0)
{
<div>
<h4>Tested media:</h4>
<table class="table">
<thead>
<tr>
<th>
@Html.DisplayNameFor(model => model.TestedMedias[0].Manufacturer)
</th>
<th>
@Html.DisplayNameFor(model => model.TestedMedias[0].Model)
</th>
<th>
@Html.DisplayNameFor(model => model.TestedMedias[0].MediumTypeName)
</th>
<th></th>
</tr>
</thead>
<tbody>
@foreach (var item in Model.TestedMedias)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.Manufacturer)
</td>
<td>
@Html.DisplayFor(modelItem => item.Model)
</td>
<td>
@Html.DisplayFor(modelItem => item.MediumTypeName)
</td>
<td>
<a asp-controller="TestedMedias" asp-action="Details" asp-route-id="@item.Id" class="btn btn-secondary" target="_blank">Details</a>
</td>
</tr>
}
</tbody>
</table>
</div>
}