diff --git a/cicm_web/Controllers/ConsoleCompanyController.cs b/cicm_web/Controllers/ConsoleCompanyController.cs new file mode 100644 index 00000000..9cb7150e --- /dev/null +++ b/cicm_web/Controllers/ConsoleCompanyController.cs @@ -0,0 +1,72 @@ +/****************************************************************************** +// Canary Islands Computer Museum Website +// ---------------------------------------------------------------------------- +// +// Filename : ConsoleCompanyController.cs +// Author(s) : Natalia Portillo +// +// --[ Description ] ---------------------------------------------------------- +// +// Console company controller +// +// --[ 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 +*******************************************************************************/ + +using cicm_web.Models; +using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.Mvc; + +namespace cicm_web.Controllers +{ + public class ConsoleCompanyController : Controller + { + readonly IHostingEnvironment hostingEnvironment; + + public ConsoleCompanyController(IHostingEnvironment env) + { + hostingEnvironment = env; + } + + public IActionResult ByLetter(char id) + { + // ToUpper() + if(id >= 'a' && id <= 'z') id -= (char)32; + // Check if not letter + if(id < 'A' || id > 'Z') id = '\0'; + + ViewBag.Letter = id; + + ConsoleCompany[] companies = + id == '\0' ? ConsoleCompany.GetAllItems() : ConsoleCompany.GetItemsStartingWithLetter(id); + + ViewBag.WebRootPath = hostingEnvironment.WebRootPath; + return View(companies); + } + + public IActionResult View(int id) + { + ConsoleCompany company = ConsoleCompany.GetItem(id); + ViewBag.Company = company; + Console[] consoles = Console.GetItemsFromCompany(id); + + ViewBag.WebRootPath = hostingEnvironment.WebRootPath; + return View(consoles); + } + } +} \ No newline at end of file diff --git a/cicm_web/Controllers/ConsoleController.cs b/cicm_web/Controllers/ConsoleController.cs new file mode 100644 index 00000000..e3580f3b --- /dev/null +++ b/cicm_web/Controllers/ConsoleController.cs @@ -0,0 +1,90 @@ +/****************************************************************************** +// Canary Islands Computer Museum Website +// ---------------------------------------------------------------------------- +// +// Filename : ConsoleController.cs +// Author(s) : Natalia Portillo +// +// --[ Description ] ---------------------------------------------------------- +// +// Videograme console controller +// +// --[ 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 +*******************************************************************************/ + +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; + +namespace cicm_web.Controllers +{ + public class ConsoleController : Controller + { + readonly IHostingEnvironment hostingEnvironment; + + public ConsoleController(IHostingEnvironment env) + { + hostingEnvironment = env; + } + + public IActionResult Index() + { + Program.Database.Operations.GetConsoles(out List consoles); + + ViewBag.ItemCount = consoles.Count; + + ViewBag.MinYear = consoles.Where(t => t.Year > 1000).Min(t => t.Year); + ViewBag.MaxYear = consoles.Where(t => t.Year > 1000).Max(t => t.Year); + + return View(); + } + + public IActionResult ByLetter(char id) + { + // ToUpper() + if(id >= 'a' && id <= 'z') id -= (char)32; + // Check if not letter + if(id < 'A' || id > 'Z') id = '\0'; + + ViewBag.Letter = id; + + ConsoleMini[] consoles = + id == '\0' ? ConsoleMini.GetAllItems() : ConsoleMini.GetItemsStartingWithLetter(id); + + return View(consoles); + } + + public IActionResult ByYear(int id) + { + ViewBag.Year = id; + + return View(ConsoleMini.GetItemsFromYear(id)); + } + + public IActionResult View(int id) + { + ViewBag.WebRootPath = hostingEnvironment.WebRootPath; + + return View(Models.Console.GetItem(id)); + } + } +} \ No newline at end of file diff --git a/cicm_web/Models/Console.cs b/cicm_web/Models/Console.cs index 96ac93c7..389fa46a 100644 --- a/cicm_web/Models/Console.cs +++ b/cicm_web/Models/Console.cs @@ -28,6 +28,7 @@ // Copyright © 2003-2018 Natalia Portillo *******************************************************************************/ +using System; using System.Collections.Generic; using System.Linq; @@ -71,10 +72,11 @@ namespace cicm_web.Models public static Console[] GetItemsFromCompany(int id) { List dbItems = null; - bool? result = Program.Database?.Operations.GetConsoles(out dbItems, id); + bool? result = Program.Database?.Operations.GetConsoles(out dbItems); if(result == null || result.Value == false || dbItems == null) return null; - return dbItems.OrderByDescending(i => i.Id).Select(TransformItem) as Console[]; + // TODO: Company chosen by DB + return dbItems.Where(t => t.Company == id).Select(TransformItem).OrderBy(t => t.Name).ToArray(); } public static Console GetItem(int id) @@ -135,4 +137,57 @@ namespace cicm_web.Models return item; } } + + public class ConsoleMini + { + public ConsoleCompany Company; + public int Id; + public string Name; + + public static ConsoleMini[] GetAllItems() + { + List dbItems = null; + bool? result = Program.Database?.Operations.GetConsoles(out dbItems); + + if(result == null || result.Value == false || dbItems == null) return null; + + List items = new List(); + foreach(Cicm.Database.Schemas.Console dbItem in dbItems) items.Add(TransformItem(dbItem)); + + return items.OrderBy(t => t.Company.Name).ThenBy(t => t.Name).ToArray(); + } + + public static ConsoleMini[] GetItemsStartingWithLetter(char letter) + { + List dbItems = null; + bool? result = Program.Database?.Operations.GetConsoles(out dbItems); + if(result == null || result.Value == false || dbItems == null) return null; + + List items = new List(); + foreach(Cicm.Database.Schemas.Console dbItem in dbItems) + if(dbItem.Name.StartsWith(new string(letter, 1), StringComparison.InvariantCultureIgnoreCase)) + items.Add(TransformItem(dbItem)); + + return items.OrderBy(t => t.Company.Name).ThenBy(t => t.Name).ToArray(); + } + + public static ConsoleMini[] GetItemsFromYear(int year) + { + List dbItems = null; + bool? result = Program.Database?.Operations.GetConsoles(out dbItems); + if(result == null || result.Value == false || dbItems == null) return null; + + List items = new List(); + foreach(Cicm.Database.Schemas.Console dbItem in dbItems) + if(dbItem.Year == year) + items.Add(TransformItem(dbItem)); + + return items.OrderBy(t => t.Company.Name).ThenBy(t => t.Name).ToArray(); + } + + static ConsoleMini TransformItem(Cicm.Database.Schemas.Console dbItem) + { + return new ConsoleMini {Company = ConsoleCompany.GetItem(dbItem.Company), Id = dbItem.Id, Name = dbItem.Name}; + } + } } \ No newline at end of file diff --git a/cicm_web/Models/ConsoleCompany.cs b/cicm_web/Models/ConsoleCompany.cs index 0c31ffc8..f99a252d 100644 --- a/cicm_web/Models/ConsoleCompany.cs +++ b/cicm_web/Models/ConsoleCompany.cs @@ -28,7 +28,9 @@ // Copyright © 2003-2018 Natalia Portillo *******************************************************************************/ +using System; using System.Collections.Generic; +using System.Linq; namespace cicm_web.Models { @@ -50,12 +52,18 @@ namespace cicm_web.Models Program.Database?.Operations.GetConsoleCompanies(out dbItems); if(result == null || result.Value == false || dbItems == null) return null; - List items = new List(); + return dbItems.Select(t => new ConsoleCompany {Id = t.Id, Name = t.Name}).OrderBy(t => t.Name).ToArray(); + } - foreach(Cicm.Database.Schemas.ConsoleCompany dbItem in dbItems) - items.Add(new ConsoleCompany {Id = dbItem.Id, Name = dbItem.Name}); + public static ConsoleCompany[] GetItemsStartingWithLetter(char letter) + { + List dbItems = null; + bool? result = Program.Database?.Operations.GetConsoleCompanies(out dbItems); + if(result == null || result.Value == false || dbItems == null) return null; - return items.ToArray(); + return dbItems + .Where(t => t.Name.StartsWith(new string(letter, 1), StringComparison.InvariantCultureIgnoreCase)) + .Select(t => new ConsoleCompany {Id = t.Id, Name = t.Name}).OrderBy(t => t.Name).ToArray(); } } } \ No newline at end of file diff --git a/cicm_web/Views/Company/ByLetter.cshtml b/cicm_web/Views/Company/ByLetter.cshtml index 06995ef4..323dad91 100644 --- a/cicm_web/Views/Company/ByLetter.cshtml +++ b/cicm_web/Views/Company/ByLetter.cshtml @@ -76,6 +76,6 @@ } else { -

There are no computers found in the database that start with this letter.

+

There are no companies found in the database that start with this letter.

}

\ No newline at end of file diff --git a/cicm_web/Views/Computer/View.cshtml b/cicm_web/Views/Computer/View.cshtml index 3eef2758..5eaf2dd1 100644 --- a/cicm_web/Views/Computer/View.cshtml +++ b/cicm_web/Views/Computer/View.cshtml @@ -59,6 +59,7 @@ } +@Model.Company.Name @Model.Model diff --git a/cicm_web/Views/Console/ByLetter.cshtml b/cicm_web/Views/Console/ByLetter.cshtml new file mode 100644 index 00000000..6ab1c149 --- /dev/null +++ b/cicm_web/Views/Console/ByLetter.cshtml @@ -0,0 +1,57 @@ +@{ +/****************************************************************************** +// Canary Islands Computer Museum Website +// ---------------------------------------------------------------------------- +// +// Filename : ByLetter.cshtml +// Author(s) : Natalia Portillo +// +// --[ Description ] ---------------------------------------------------------- +// +// Lists computers by letter (or all) +// +// --[ 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"] = "Consoles"; +} + +@model IEnumerable + +

Search results:

+

+ @if(ViewBag.Letter != '\0') + { + @ViewBag.Letter
+ } + + @if(Model.Any()) + { +

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

+ } + else + { +

There are no videoconsoles found in the database that start with this letter.

+ } +

diff --git a/cicm_web/Views/Console/ByYear.cshtml b/cicm_web/Views/Console/ByYear.cshtml new file mode 100644 index 00000000..3ead0ebd --- /dev/null +++ b/cicm_web/Views/Console/ByYear.cshtml @@ -0,0 +1,59 @@ +@{ + /****************************************************************************** +// Canary Islands Computer Museum Website +// ---------------------------------------------------------------------------- +// +// Filename : ByYear.cshtml +// Author(s) : Natalia Portillo +// +// --[ Description ] ---------------------------------------------------------- +// +// Lists computers by letter (or all) +// +// --[ 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"] = "Computers"; +} + +@model IEnumerable + +

Search results:

+

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

+ @Model.Count() videoconsoles found in the database.
+ @foreach(ConsoleMini console in Model) + { + + @console.Company.Name @console.Name +
+ } +

+ } + else + { +

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

+ } +

\ No newline at end of file diff --git a/cicm_web/Views/Console/Index.cshtml b/cicm_web/Views/Console/Index.cshtml new file mode 100644 index 00000000..98fae57c --- /dev/null +++ b/cicm_web/Views/Console/Index.cshtml @@ -0,0 +1,341 @@ +@{ + /****************************************************************************** +// Canary Islands Computer Museum Website +// ---------------------------------------------------------------------------- +// +// Filename : Contact.cshtml +// Author(s) : Natalia Portillo +// +// --[ Description ] ---------------------------------------------------------- +// +// Contact page +// +// --[ 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"] = "Videoconsoles"; +} + +

+ Here you can consult our database.
+ In this database you can find technical information as well as videoconsoles history, catalogued by companies, alfabetically and by release date.
+ @ViewBag.ItemCount videoconsoles actually catalogued in the database. +

+ +

+
+
+ Search by companies +
+ + Q + + + W + + + E + + + R + + + T + + + Y + + + U + + + I + + + O + + + P + +
+ + A + + + S + + + D + + + F + + + G + + + H + + + J + + + K + + + L + +
+ + Z + + + X + + + C + + + V + + + B + + + N + + + M + +
+ + All companies + +

+

+ Alfabetically search +
+ + Q + + + W + + + E + + + R + + + T + + + Y + + + U + + + I + + + O + + + P + +
+ + A + + + S + + + D + + + F + + + G + + + H + + + J + + + K + + + L + +
+ + Z + + + X + + + C + + + V + + + B + + + N + + + M + +
+ + All computers + +

+

+ Search by year +
+ @{ int counter = 0; } + @for(int i = ViewBag.MinYear; i <= ViewBag.MaxYear; i++) + { + { + counter++; + } + + @i + + if(counter % 8 == 0) {
} + } +

\ No newline at end of file diff --git a/cicm_web/Views/Console/View.cshtml b/cicm_web/Views/Console/View.cshtml new file mode 100644 index 00000000..7b35b983 --- /dev/null +++ b/cicm_web/Views/Console/View.cshtml @@ -0,0 +1,447 @@ +@{ + /****************************************************************************** +// 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"] = "Videoconsoles"; +} +@using System.IO +@model cicm_web.Models.Console + +@if(File.Exists(System.IO.Path.Combine(ViewBag.WebRootPath, "assets/logos/consoles", Model.Company.Id + ".gif"))) +{ + +} + +@if(File.Exists(System.IO.Path.Combine(ViewBag.WebRootPath, "assets/logos/consoles", Model.Company.Id + ".jpg"))) +{ + +} + +@if(File.Exists(System.IO.Path.Combine(ViewBag.WebRootPath, "assets/logos/consoles", Model.Company.Id + ".png"))) +{ + +} + +@if(Model.Year == 1000) +{ + +
PROTOTYPE
+
+} + +@Model.Company.Name @Model.Name +
+@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) + { + if(Model.Palette > 0) + { + + } + else + { + + } + } + 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.Format != null) +{ + + + @if(Model.Format.Id != 30) + { + if(Model.Format.Id != 8) + { + if(Model.Format.Id != 6) + { + string cap1Bytes = Model.Cap > 1024 ? (Model.Cap > 1048576 ? $"{Model.Cap / 1048576} GBytes" : $"{Model.Cap / 1024} MBytes") : (Model.Cap > 0 ? $"{Model.Cap} Kbytes" : "Unknown capacity"); + + if(Model.Format.Id != 10) + { + if(Model.Format.Id != 15) + { + if(Model.Format.Id != 16) + { + if(Model.Format.Id != 36) + { + if(Model.Format.Id != 22) + { + if(Model.Format.Id != 23) + { + if(Model.Format.Id != 39) + { + if(Model.Format.Id != 31) + { + + } + else + { + + } + } + else + { + + } + } + else + { + + } + } + else + { + + } + } + else + { + + } + } + else + { + + } + } + else + { + + } + } + else + { + + } + } + else + { + string cap1Bits = Model.Cap > 1000 ? (Model.Cap > 1000000 ? $"{Model.Cap / 1000000} GBits" : $"{Model.Cap / 1000} MBits") : (Model.Cap > 0 ? $"{Model.Cap} 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
+
+ RAM +
+
@($"{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.Colors from a palette of @Model.Palette@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
+
+ Primary disk +
+
@Model.Format.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 (@Model.Cap bps)None
+ +@if(File.Exists(System.IO.Path.Combine(ViewBag.WebRootPath, "assets/photos/consoles", Model.Id + ".jpg"))) +{ + +} \ No newline at end of file diff --git a/cicm_web/Views/ConsoleCompany/ByLetter.cshtml b/cicm_web/Views/ConsoleCompany/ByLetter.cshtml new file mode 100644 index 00000000..d68db188 --- /dev/null +++ b/cicm_web/Views/ConsoleCompany/ByLetter.cshtml @@ -0,0 +1,81 @@ +@{ + /****************************************************************************** +// Canary Islands Computer Museum Website +// ---------------------------------------------------------------------------- +// +// Filename : ByLetter.cshtml +// Author(s) : Natalia Portillo +// +// --[ Description ] ---------------------------------------------------------- +// +// Lists companies by letter (or all) +// +// --[ 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"] = "Console companies"; +} +@using System.IO +@model IEnumerable + +

Search results:

+

+ @if(ViewBag.Letter != '\0') + { + @ViewBag.Letter +
+ } + + @if(Model.Any()) + { +

+ @Model.Count() companies found in the database.
+ @foreach(ConsoleCompany company in Model) + { + if(File.Exists(System.IO.Path.Combine(ViewBag.WebRootPath, "assets/logos/consoles", company.Id + ".gif"))) + { + + } + + if(File.Exists(System.IO.Path.Combine(ViewBag.WebRootPath, "assets/logos/consoles", company.Id + ".jpg"))) + { + + } + + if(File.Exists(System.IO.Path.Combine(ViewBag.WebRootPath, "assets/logos/consoles", company.Id + ".png"))) + { + + } + + + @company.Name +
+ } +

+ } + else + { +

There are no console companies found in the database that start with this letter.

+ } +

\ No newline at end of file diff --git a/cicm_web/Views/ConsoleCompany/View.cshtml b/cicm_web/Views/ConsoleCompany/View.cshtml new file mode 100644 index 00000000..cba07ebe --- /dev/null +++ b/cicm_web/Views/ConsoleCompany/View.cshtml @@ -0,0 +1,80 @@ +@{ + /****************************************************************************** +// Canary Islands Computer Museum Website +// ---------------------------------------------------------------------------- +// +// Filename : ByLetter.cshtml +// Author(s) : Natalia Portillo +// +// --[ Description ] ---------------------------------------------------------- +// +// Lists computers by company +// +// --[ 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"] = "Companies"; +} +@using System.IO +@model IEnumerable + +

Search results:

+

+ @if(ViewBag.Company != null) + { + if(File.Exists(System.IO.Path.Combine(ViewBag.WebRootPath, "assets/logos/consoles", ViewBag.Company.Id + ".gif"))) + { + + } + + if(File.Exists(System.IO.Path.Combine(ViewBag.WebRootPath, "assets/logos/consoles", ViewBag.Company.Id + ".jpg"))) + { + + } + + if(File.Exists(System.IO.Path.Combine(ViewBag.WebRootPath, "assets/logos/consoles", ViewBag.Company.Id + ".png"))) + { + + } + @ViewBag.Company.Name +
+ } + + @if(Model.Any()) + { +

+ @Model.Count() computers found in the database.
+ @foreach(cicm_web.Models.Console console in Model) + { + + @console.Name +
+ } +

+ } + else + { +

There are no videoconsoles found in the database that belong to that company.

+ } +

\ No newline at end of file diff --git a/cicm_web/Views/Shared/_Layout.cshtml b/cicm_web/Views/Shared/_Layout.cshtml index 26cc6640..243bb2f2 100644 --- a/cicm_web/Views/Shared/_Layout.cshtml +++ b/cicm_web/Views/Shared/_Layout.cshtml @@ -103,8 +103,9 @@ - + Consoles diff --git a/cicm_web/cicm_web.csproj b/cicm_web/cicm_web.csproj index 564cd6d3..b788cf6b 100644 --- a/cicm_web/cicm_web.csproj +++ b/cicm_web/cicm_web.csproj @@ -2,7 +2,7 @@ netcoreapp2.0 - 3.0.99.84 + 3.0.99.86 Canary Islands Computer Museum Copyright © 2003-2018 Natalia Portillo Canary Islands Computer Museum Website