diff --git a/cicm_web/Controllers/MachineController.cs b/cicm_web/Controllers/MachineController.cs index e4393a2f..4fbfaf14 100644 --- a/cicm_web/Controllers/MachineController.cs +++ b/cicm_web/Controllers/MachineController.cs @@ -28,7 +28,8 @@ // Copyright © 2003-2018 Natalia Portillo *******************************************************************************/ -using cicm_web.Models; +using System.Linq; +using Cicm.Database.Models; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Mvc; @@ -36,18 +37,20 @@ namespace cicm_web.Controllers { public class MachineController : Controller { + readonly cicmContext _context; readonly IHostingEnvironment hostingEnvironment; - public MachineController(IHostingEnvironment env) + public MachineController(IHostingEnvironment env, cicmContext context) { hostingEnvironment = env; + _context = context; } public IActionResult View(int id) { ViewBag.WebRootPath = hostingEnvironment.WebRootPath; - return View(Machine.GetItem(id)); + return View(_context.Machines.FirstOrDefault(m => m.Id == id)); } } } \ No newline at end of file diff --git a/cicm_web/Views/Machine/View.cshtml b/cicm_web/Views/Machine/View.cshtml index cea6db50..168646cb 100644 --- a/cicm_web/Views/Machine/View.cshtml +++ b/cicm_web/Views/Machine/View.cshtml @@ -33,8 +33,12 @@ } @using System.IO @using Cicm.Database -@model Machine - +@using Cicm.Database.Models +@using MemoryByMachine = Cicm.Database.Models.MemoryByMachine +@using SoundByMachine = Cicm.Database.Models.SoundByMachine +@using StorageByMachine = Cicm.Database.Models.StorageByMachine +@model Cicm.Database.Models.Machine +@* TODO
@if(Model.Company.LastLogo != null && File.Exists(System.IO.Path.Combine(ViewBag.WebRootPath, "assets/logos", Model.Company.LastLogo.Guid + ".svg"))) { @@ -56,8 +60,11 @@ }
+*@ -@if(Model.Introduced.Year == 1000) +@{ int counter = 0; } + +@if(Model.Introduced.HasValue && Model.Introduced.Value.Year == 1000) {| - @Model.Introduced.ToLongDateString() + asp-route-id="@Model.Introduced.Value.Year"> + @Model.Introduced.Value.ToLongDateString() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -129,239 +136,239 @@ |
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @@ -371,7 +378,7 @@ |
|