diff --git a/cicm_web/Areas/Admin/Controllers/OwnedMachineController.cs b/cicm_web/Areas/Admin/Controllers/OwnedMachineController.cs
index 7e436240..75df9e9f 100644
--- a/cicm_web/Areas/Admin/Controllers/OwnedMachineController.cs
+++ b/cicm_web/Areas/Admin/Controllers/OwnedMachineController.cs
@@ -173,8 +173,24 @@ namespace cicm_web.Areas.Admin.Controllers
{
if(id == null) return NotFound();
- OwnedMachine ownedMachine = await _context.OwnedMachines
- .Include(o => o.Machine).FirstOrDefaultAsync(m => m.Id == id);
+ OwnedMachineViewModel ownedMachine = await _context.OwnedMachines
+ .Include(o => o.Machine)
+ .Select(o => new OwnedMachineViewModel
+ {
+ AcquisitionDate = o.AcquisitionDate,
+ Boxed = o.Boxed,
+ LastStatusDate = o.LastStatusDate,
+ LostDate = o.LostDate,
+ Machine =
+ $"{o.Machine.Company.Name} {o.Machine.Name}",
+ Manuals = o.Manuals,
+ SerialNumber = o.SerialNumber,
+ SerialNumberVisible =
+ o.SerialNumberVisible,
+ Status = o.Status,
+ User = o.User.UserName,
+ Id = o.Id
+ }).FirstOrDefaultAsync(m => m.Id == id);
if(ownedMachine == null) return NotFound();
return View(ownedMachine);
diff --git a/cicm_web/Areas/Admin/Views/OwnedMachine/Delete.cshtml b/cicm_web/Areas/Admin/Views/OwnedMachine/Delete.cshtml
index 4d5234be..aa9e4b8e 100644
--- a/cicm_web/Areas/Admin/Views/OwnedMachine/Delete.cshtml
+++ b/cicm_web/Areas/Admin/Views/OwnedMachine/Delete.cshtml
@@ -1,4 +1,4 @@
-@model Cicm.Database.Models.OwnedMachine
+@model cicm_web.Areas.Admin.Models.OwnedMachineViewModel
@{
ViewData["Title"] = "Delete";
@@ -8,74 +8,86 @@
Are you sure you want to delete this?
-
OwnedMachine
+
Owned machine
- -
+
-
@Html.DisplayNameFor(model => model.AcquisitionDate)
- -
+
-
@Html.DisplayFor(model => model.AcquisitionDate)
- -
+
-
@Html.DisplayNameFor(model => model.LostDate)
- -
- @Html.DisplayFor(model => model.LostDate)
+
-
+ @Html.DisplayFor(model => model.LostDateDisplay)
- -
+
-
@Html.DisplayNameFor(model => model.Status)
- -
+
-
@Html.DisplayFor(model => model.Status)
- -
+
-
@Html.DisplayNameFor(model => model.LastStatusDate)
- -
- @Html.DisplayFor(model => model.LastStatusDate)
+
-
+ @Html.DisplayFor(model => model.LastStatusDateDisplay)
- -
+
-
@Html.DisplayNameFor(model => model.Trade)
- -
+
-
@Html.DisplayFor(model => model.Trade)
- -
+
-
@Html.DisplayNameFor(model => model.Boxed)
- -
+
-
@Html.DisplayFor(model => model.Boxed)
- -
+
-
@Html.DisplayNameFor(model => model.Manuals)
- -
+
-
@Html.DisplayFor(model => model.Manuals)
- -
+
-
@Html.DisplayNameFor(model => model.SerialNumber)
- -
+
-
@Html.DisplayFor(model => model.SerialNumber)
- -
+
-
@Html.DisplayNameFor(model => model.SerialNumberVisible)
- -
+
-
@Html.DisplayFor(model => model.SerialNumberVisible)
- -
+
-
@Html.DisplayNameFor(model => model.Machine)
- -
- @Html.DisplayFor(model => model.Machine.Name)
-
+ -
+ @Html.DisplayFor(model => model.Machine)
+
+ -
+ @Html.DisplayNameFor(model => model.User)
+
+ -
+ @Html.DisplayFor(model => model.User)
+
-
+
-
+
\ No newline at end of file
diff --git a/cicm_web/cicm_web.csproj b/cicm_web/cicm_web.csproj
index 1a6253cc..b1c232d7 100644
--- a/cicm_web/cicm_web.csproj
+++ b/cicm_web/cicm_web.csproj
@@ -2,7 +2,7 @@
netcoreapp2.2
- 3.0.99.685
+ 3.0.99.686
Canary Islands Computer Museum
Copyright © 2003-2018 Natalia Portillo
Canary Islands Computer Museum Website