diff --git a/cicm_web/Controllers/ComputerController.cs b/cicm_web/Controllers/ComputerController.cs index 23025c4b..d4bf5e05 100644 --- a/cicm_web/Controllers/ComputerController.cs +++ b/cicm_web/Controllers/ComputerController.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using System.Linq; using cicm_web.Models; +using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Mvc; using Computer = Cicm.Database.Schemas.Computer; @@ -8,6 +9,13 @@ namespace cicm_web.Controllers { public class ComputerController : Controller { + readonly IHostingEnvironment hostingEnvironment; + + public ComputerController(IHostingEnvironment env) + { + hostingEnvironment = env; + } + public IActionResult Index() { Program.Database.Operations.GetComputers(out List computers); @@ -41,5 +49,12 @@ namespace cicm_web.Controllers return View(ComputerMini.GetItemsFromYear(id)); } + + public IActionResult View(int id) + { + ViewBag.WebRootPath = hostingEnvironment.WebRootPath; + + return View(Models.Computer.GetItem(id)); + } } } \ No newline at end of file diff --git a/cicm_web/Views/Computer/ByYear.cshtml b/cicm_web/Views/Computer/ByYear.cshtml index 63cfdb80..9e431266 100644 --- a/cicm_web/Views/Computer/ByYear.cshtml +++ b/cicm_web/Views/Computer/ByYear.cshtml @@ -1,9 +1,9 @@ @{ -/****************************************************************************** + /****************************************************************************** // Canary Islands Computer Museum Website // ---------------------------------------------------------------------------- // -// Filename : ByLetter.cshtml +// Filename : ByYear.cshtml // Author(s) : Natalia Portillo // // --[ Description ] ---------------------------------------------------------- @@ -35,20 +35,25 @@ @model IEnumerable

Search results:

-

- @ViewBag.Year
+

+ @ViewBag.Year
@if(Model.Any()) { -

@Model.Count() computers found in the database.
- @foreach(ComputerMini computer in @Model) - { - @computer.Company.Name @computer.Model
- } +

+ @Model.Count() computers found in the database.
+ @foreach(ComputerMini computer in Model) + { + + @computer.Company.Name @computer.Model +
+ }

} else {

There are no computers found in the database released this year.

} -

+

\ No newline at end of file diff --git a/cicm_web/Views/Computer/View.cshtml b/cicm_web/Views/Computer/View.cshtml new file mode 100644 index 00000000..3eef2758 --- /dev/null +++ b/cicm_web/Views/Computer/View.cshtml @@ -0,0 +1,558 @@ +@{ + /****************************************************************************** +// Canary Islands Computer Museum Website +// ---------------------------------------------------------------------------- +// +// Filename : Index.cshtml +// Author(s) : Natalia Portillo +// +// --[ Description ] ---------------------------------------------------------- +// +// Index page (and news) +// +// --[ License ] -------------------------------------------------------------- +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// ---------------------------------------------------------------------------- +// Copyright © 2003-2018 Natalia Portillo +*******************************************************************************/ + + ViewData["Title"] = "Computer"; +} +@using System.IO +@model Computer + +@if(File.Exists(System.IO.Path.Combine(ViewBag.WebRootPath, "assets/logos/computers", Model.Company.Id + ".gif"))) +{ + +} + +@if(File.Exists(System.IO.Path.Combine(ViewBag.WebRootPath, "assets/logos/computers", Model.Company.Id + ".jpg"))) +{ + +} + +@if(File.Exists(System.IO.Path.Combine(ViewBag.WebRootPath, "assets/logos/computers", Model.Company.Id + ".png"))) +{ + +} + +@if(Model.Year == 1000) +{ + +
PROTOTYPE
+
+} + + + +@if(Model.Year != 1000) +{ + + + + +} + + + @if(Model.Cpu1.Id != 4) + { + if(Model.Cpu1.Id != 5) + { + if(Model.Mhz1 > 0) + { + if(Model.Bits > 0) + { + + } + else + { + + } + } + else + { + + } + } + else + { + + } + } + else + { } + + +@if(Model.Cpu2 != null) +{ + + + @if(Model.Cpu2.Id != 4) + { + if(Model.Cpu2.Id != 5) + { + if(Model.Mhz2 > 0) + { + if(Model.Bits > 0) + { + + } + else + { + + } + } + else + { + + } + } + else + { + + } + } + else + { } + +} + + + @if(Model.Ram > 1024) + { + if(Model.Ram > 1048576) + { + + } + else + { + + } + } + else + { + if(Model.Ram == 0) + { + + } + else + { + + } + } + + + + @if(Model.Rom > 1024) + { + if(Model.Rom > 1048576) + { + + } + else + { + + } + } + else + { + if(Model.Rom == 0) + { + + } + else + { + + } + } + + + + + @if(Model.Gpu.Id > 1) + { + if(Model.Gpu.Id > 2) + { + + } + else + { + + } + } + else + { } + + + + @if(Model.Vram > 1024) + { + if(Model.Vram > 1048576) + { + + } + else + { + + } + } + else + { + if(Model.Vram == 0) + { + + } + else + { + + } + } + + + + @if(Model.Resolution != "???") + { + + } + else + { + + } + + + + + @if(Model.Colors > 0) + { + + } + else + { + + } + + + + @if(Model.Spu.Id > 1) + { + if(Model.Spu.Id > 2) + { + if(Model.SoundChannels > 0) + { + + } + else + { + + } + } + else + { + + } + } + else + { } + + + + @if(Model.Mpu.Id > 1) + { + if(Model.Mpu.Id > 2) + { + if(Model.MusicChannels > 0) + { + + } + else + { + + } + } + else + { + + } + } + else + { } + +@if(Model.Hdd1 != null && Model.Hdd1.Id > 0 && Model.Hdd1.Id != 30) +{ + + + + +} + +@if(Model.Disk1 != null) +{ + + + @if(Model.Disk1.Id != 30) + { + int cap1 = int.Parse(Model.Cap1); + + if(Model.Disk1.Id != 8) + { + if(Model.Disk1.Id != 6) + { + string cap1Bytes = cap1 > 1024 ? (cap1 > 1048576 ? $"{cap1 / 1048576} GBytes" : $"{cap1 / 1024} MBytes") : (cap1 > 0 ? $"{cap1} Kbytes" : "Unknown capacity"); + + if(Model.Disk1.Id != 10) + { + if(Model.Disk1.Id != 15) + { + if(Model.Disk1.Id != 16) + { + if(Model.Disk1.Id != 36) + { + if(Model.Disk1.Id != 22) + { + if(Model.Disk1.Id != 23) + { + if(Model.Disk1.Id != 39) + { + if(Model.Disk1.Id != 31) + { + + } + else + { + + } + } + else + { + + } + } + else + { + + } + } + else + { + + } + } + else + { + + } + } + else + { + + } + } + else + { + + } + } + else + { + + } + } + else + { + string cap1Bits = cap1 > 1000 ? (cap1 > 1000000 ? $"{cap1 / 1000000} GBits" : $"{cap1 / 1000} MBits") : (cap1 > 0 ? $"{cap1} KBits" : "Unknown capacity"); + + + } + } + else + { + + } + } + else + { } + +} +@if(Model.Disk2 != null) +{ + + + @if(Model.Disk2.Id != 30) + { + int cap2 = int.Parse(Model.Cap2); + + if(Model.Disk2.Id != 8) + { + if(Model.Disk2.Id != 6) + { + string cap2Bytes = cap2 > 1024 ? (cap2 > 1048576 ? $"{cap2 / 1048576} GBytes" : $"{cap2 / 1024} MBytes") : (cap2 > 0 ? $"{cap2} Kbytes" : "Unknown capacity"); + + if(Model.Disk2.Id != 10) + { + if(Model.Disk2.Id != 15) + { + if(Model.Disk2.Id != 16) + { + if(Model.Disk2.Id != 36) + { + if(Model.Disk2.Id != 22) + { + if(Model.Disk2.Id != 23) + { + if(Model.Disk2.Id != 39) + { + if(Model.Disk2.Id != 31) + { + + } + else + { + + } + } + else + { + + } + } + else + { + + } + } + else + { + + } + } + else + { + + } + } + else + { + + } + } + else + { + + } + } + else + { + + } + } + else + { + string cap2Bits = cap2 > 1000 ? (cap2 > 1000000 ? $"{cap2 / 1000000} GBits" : $"{cap2 / 1000} MBits") : (cap2 > 0 ? $"{cap2} KBits" : "Unknown capacity"); + + + } + } + else + { + + } + } + else + { } + +} +
+
+ Year +
+
+ @Model.Year +
+
+ Primary processor +
+
@Model.Cpu1.Name @("@") @($"{Model.Mhz1}Mhz") (@Model.Bits bits)@Model.Cpu1.Name @("@") @($"{Model.Mhz1}Mhz")@Model.Cpu1.NameUnknown dataNone
+
+ Secondary processor +
+
@Model.Cpu2.Name @("@") @($"{Model.Mhz2}Mhz") (@Model.Bits bits)@Model.Cpu2.Name @("@") @($"{Model.Mhz2}Mhz")@Model.Cpu2.NameUnknown dataNone
+
+ Base RAM memory +
+
@($"{Model.Ram / 1048576}") Gbytes@($"{Model.Ram / 1024}") MbytesUnknown data@Model.Ram Kbytes
+
+ ROM +
+
@($"{Model.Rom / 1048576}") Gbytes@($"{Model.Rom / 1024}") MbytesUnknown data@Model.Rom Kbytes
+
+ Graphics processor +
+
@Model.Gpu.NameUnknown dataNone
+
+ Video memory +
+
@($"{Model.Vram / 1048576}") Gbytes@($"{Model.Vram / 1024}") MbytesUnknown data@Model.Vram Kbytes
+
+ Video resolution +
+
@Model.ResolutionUnknown data
+
+ Colors +
+
@Model.ColorsUnknown data
+
+ Sound processor +
+
@Model.Spu.Name (@Model.SoundChannels channels)@Model.Spu.NameUnknown dataNone
+
+ Music synthetizer +
+
@Model.Mpu.Name (@Model.MusicChannels channels)@Model.Mpu.NameUnknown dataNone
+
+ Disk interfaces +
+
+ @Model.Hdd1.Description + @if(Model.Hdd2 != null && Model.Hdd2.Id > 0 && Model.Hdd2.Id != 30) + { +
+ @Model.Hdd2.Description + } + @if(Model.Hdd3 != null && Model.Hdd3.Id > 0 && Model.Hdd3.Id != 30) + { +
+ @Model.Hdd3.Description + } +
+
+ Primary disk +
+
@Model.Disk1.Description (@cap1Bytes)Propietary (@cap1Bytes)Digital tape (@cap1Bytes)Punched card (@cap1Bytes)Chip card (@cap1Bytes)Magnetic card (@cap1Bytes)Memory (@cap1Bytes)Magneto-optical (@cap1Bytes)Optical disk (@cap1Bytes)Cartridge (@cap1Bits)Standard audio cassette (@cap1 bps)None
+
+ Secondary disk +
+
@Model.Disk2.Description (@cap2Bytes)Propietary (@cap2Bytes)Digital tape (@cap2Bytes)Punched card (@cap2Bytes)Chip card (@cap2Bytes)Magnetic card (@cap2Bytes)Memory (@cap2Bytes)Magneto-optical (@cap2Bytes)Optical disk (@cap2Bytes)Cartridge (@cap2Bits)Standard audio cassette (@cap2 bps)None
+ +@if(File.Exists(System.IO.Path.Combine(ViewBag.WebRootPath, "assets/photos/computers", Model.Id + ".jpg"))) +{ + +} \ No newline at end of file diff --git a/cicm_web/cicm_web.csproj b/cicm_web/cicm_web.csproj index 1c7f4829..026bbcf7 100644 --- a/cicm_web/cicm_web.csproj +++ b/cicm_web/cicm_web.csproj @@ -2,7 +2,7 @@ netcoreapp2.0 - 3.0.99.68 + 3.0.99.69 Canary Islands Computer Museum Copyright © 2003-2018 Natalia Portillo Canary Islands Computer Museum Website