diff --git a/cicm_web/Controllers/ComputerController.cs b/cicm_web/Controllers/ComputerController.cs new file mode 100644 index 00000000..39d8641c --- /dev/null +++ b/cicm_web/Controllers/ComputerController.cs @@ -0,0 +1,22 @@ +using System.Collections.Generic; +using System.Linq; +using Cicm.Database.Schemas; +using Microsoft.AspNetCore.Mvc; + +namespace cicm_web.Controllers +{ + public class ComputerController : Controller + { + public IActionResult Index() + { + Program.Database.Operations.GetComputers(out List computers); + + ViewBag.ItemCount = computers.Count; + + ViewBag.MinYear = computers.Where(t => t.Year > 1000).Min(t => t.Year); + ViewBag.MaxYear = computers.Where(t => t.Year > 1000).Max(t => t.Year); + + return View(); + } + } +} \ No newline at end of file diff --git a/cicm_web/Models/News.cs b/cicm_web/Models/News.cs index 74db2cf4..f78ead34 100644 --- a/cicm_web/Models/News.cs +++ b/cicm_web/Models/News.cs @@ -85,7 +85,7 @@ namespace cicm_web.Models case NewsType.NewComputerInDb: text = "New computer added to the database."; imageUrl = "assets/photos/computers/"; - targetView = "computer"; + targetView = "Computer"; computer = Computer.GetItem(dbItem.AffectedId); subtext = $"{computer.Company.Name} - {computer.Model}"; break; diff --git a/cicm_web/Views/Computer/Index.cshtml b/cicm_web/Views/Computer/Index.cshtml new file mode 100644 index 00000000..44a16b5d --- /dev/null +++ b/cicm_web/Views/Computer/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"] = "Computers"; +} + +

+ Here you can consult our database.
+ In this database you can find technical information as well as computers history, catalogued by companies, alfabetically and by release date.
+ @ViewBag.ItemCount computers 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/Shared/_Layout.cshtml b/cicm_web/Views/Shared/_Layout.cshtml index 2f8847c4..26cc6640 100644 --- a/cicm_web/Views/Shared/_Layout.cshtml +++ b/cicm_web/Views/Shared/_Layout.cshtml @@ -1,4 +1,4 @@ -@using System.Reflection +@using Microsoft.Extensions.PlatformAbstractions @{ /****************************************************************************** // Canary Islands Computer Museum Website @@ -96,8 +96,9 @@