mirror of
https://github.com/claunia/marechai.git
synced 2025-12-16 19:14:25 +00:00
Add controller for computers.
This commit is contained in:
22
cicm_web/Controllers/ComputerController.cs
Normal file
22
cicm_web/Controllers/ComputerController.cs
Normal file
@@ -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<Computer> 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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -85,7 +85,7 @@ namespace cicm_web.Models
|
|||||||
case NewsType.NewComputerInDb:
|
case NewsType.NewComputerInDb:
|
||||||
text = "New computer added to the database.";
|
text = "New computer added to the database.";
|
||||||
imageUrl = "assets/photos/computers/";
|
imageUrl = "assets/photos/computers/";
|
||||||
targetView = "computer";
|
targetView = "Computer";
|
||||||
computer = Computer.GetItem(dbItem.AffectedId);
|
computer = Computer.GetItem(dbItem.AffectedId);
|
||||||
subtext = $"{computer.Company.Name} - {computer.Model}";
|
subtext = $"{computer.Company.Name} - {computer.Model}";
|
||||||
break;
|
break;
|
||||||
|
|||||||
341
cicm_web/Views/Computer/Index.cshtml
Normal file
341
cicm_web/Views/Computer/Index.cshtml
Normal file
@@ -0,0 +1,341 @@
|
|||||||
|
@{
|
||||||
|
/******************************************************************************
|
||||||
|
// Canary Islands Computer Museum Website
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// Filename : Contact.cshtml
|
||||||
|
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
||||||
|
//
|
||||||
|
// --[ 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 <http://www.gnu.org/licenses/>.
|
||||||
|
//
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// Copyright © 2003-2018 Natalia Portillo
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
ViewData["Title"] = "Computers";
|
||||||
|
}
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Here you can consult our database.<br />
|
||||||
|
In this database you can find technical information as well as computers history, catalogued by companies, alfabetically and by release date.<br />
|
||||||
|
@ViewBag.ItemCount computers actually catalogued in the database.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
|
Search by companies
|
||||||
|
<br>
|
||||||
|
<a asp-action=ByLetter
|
||||||
|
asp-controller=Company
|
||||||
|
asp-route-id=Q>
|
||||||
|
Q
|
||||||
|
</a>
|
||||||
|
<a asp-action=ByLetter
|
||||||
|
asp-controller=Company
|
||||||
|
asp-route-id=W>
|
||||||
|
W
|
||||||
|
</a>
|
||||||
|
<a asp-action=ByLetter
|
||||||
|
asp-controller=Company
|
||||||
|
asp-route-id=E>
|
||||||
|
E
|
||||||
|
</a>
|
||||||
|
<a asp-action=ByLetter
|
||||||
|
asp-controller=Company
|
||||||
|
asp-route-id=R>
|
||||||
|
R
|
||||||
|
</a>
|
||||||
|
<a asp-action=ByLetter
|
||||||
|
asp-controller=Company
|
||||||
|
asp-route-id=T>
|
||||||
|
T
|
||||||
|
</a>
|
||||||
|
<a asp-action=ByLetter
|
||||||
|
asp-controller=Company
|
||||||
|
asp-route-id=Y>
|
||||||
|
Y
|
||||||
|
</a>
|
||||||
|
<a asp-action=ByLetter
|
||||||
|
asp-controller=Company
|
||||||
|
asp-route-id=U>
|
||||||
|
U
|
||||||
|
</a>
|
||||||
|
<a asp-action=ByLetter
|
||||||
|
asp-controller=Company
|
||||||
|
asp-route-id=I>
|
||||||
|
I
|
||||||
|
</a>
|
||||||
|
<a asp-action=ByLetter
|
||||||
|
asp-controller=Company
|
||||||
|
asp-route-id=O>
|
||||||
|
O
|
||||||
|
</a>
|
||||||
|
<a asp-action=ByLetter
|
||||||
|
asp-controller=Company
|
||||||
|
asp-route-id=P>
|
||||||
|
P
|
||||||
|
</a>
|
||||||
|
<br>
|
||||||
|
<a asp-action=ByLetter
|
||||||
|
asp-controller=Company
|
||||||
|
asp-route-id=A>
|
||||||
|
A
|
||||||
|
</a>
|
||||||
|
<a asp-action=ByLetter
|
||||||
|
asp-controller=Company
|
||||||
|
asp-route-id=S>
|
||||||
|
S
|
||||||
|
</a>
|
||||||
|
<a asp-action=ByLetter
|
||||||
|
asp-controller=Company
|
||||||
|
asp-route-id=D>
|
||||||
|
D
|
||||||
|
</a>
|
||||||
|
<a asp-action=ByLetter
|
||||||
|
asp-controller=Company
|
||||||
|
asp-route-id=F>
|
||||||
|
F
|
||||||
|
</a>
|
||||||
|
<a asp-action=ByLetter
|
||||||
|
asp-controller=Company
|
||||||
|
asp-route-id=G>
|
||||||
|
G
|
||||||
|
</a>
|
||||||
|
<a asp-action=ByLetter
|
||||||
|
asp-controller=Company
|
||||||
|
asp-route-id=H>
|
||||||
|
H
|
||||||
|
</a>
|
||||||
|
<a asp-action=ByLetter
|
||||||
|
asp-controller=Company
|
||||||
|
asp-route-id=J>
|
||||||
|
J
|
||||||
|
</a>
|
||||||
|
<a asp-action=ByLetter
|
||||||
|
asp-controller=Company
|
||||||
|
asp-route-id=K>
|
||||||
|
K
|
||||||
|
</a>
|
||||||
|
<a asp-action=ByLetter
|
||||||
|
asp-controller=Company
|
||||||
|
asp-route-id=L>
|
||||||
|
L
|
||||||
|
</a>
|
||||||
|
<br>
|
||||||
|
<a asp-action=ByLetter
|
||||||
|
asp-controller=Company
|
||||||
|
asp-route-id=Z>
|
||||||
|
Z
|
||||||
|
</a>
|
||||||
|
<a asp-action=ByLetter
|
||||||
|
asp-controller=Company
|
||||||
|
asp-route-id=X>
|
||||||
|
X
|
||||||
|
</a>
|
||||||
|
<a asp-action=ByLetter
|
||||||
|
asp-controller=Company
|
||||||
|
asp-route-id=C>
|
||||||
|
C
|
||||||
|
</a>
|
||||||
|
<a asp-action=ByLetter
|
||||||
|
asp-controller=Company
|
||||||
|
asp-route-id=V>
|
||||||
|
V
|
||||||
|
</a>
|
||||||
|
<a asp-action=ByLetter
|
||||||
|
asp-controller=Company
|
||||||
|
asp-route-id=B>
|
||||||
|
B
|
||||||
|
</a>
|
||||||
|
<a asp-action=ByLetter
|
||||||
|
asp-controller=Company
|
||||||
|
asp-route-id=N>
|
||||||
|
N
|
||||||
|
</a>
|
||||||
|
<a asp-action=ByLetter
|
||||||
|
asp-controller=Company
|
||||||
|
asp-route-id=M>
|
||||||
|
M
|
||||||
|
</a>
|
||||||
|
<br>
|
||||||
|
<a asp-action=ByLetter
|
||||||
|
asp-controller=Company>
|
||||||
|
All companies
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
Alfabetically search
|
||||||
|
<br>
|
||||||
|
<a asp-action=ByLetter
|
||||||
|
asp-controller=Computer
|
||||||
|
asp-route-id=Q>
|
||||||
|
Q
|
||||||
|
</a>
|
||||||
|
<a asp-action=ByLetter
|
||||||
|
asp-controller=Computer
|
||||||
|
asp-route-id=W>
|
||||||
|
W
|
||||||
|
</a>
|
||||||
|
<a asp-action=ByLetter
|
||||||
|
asp-controller=Computer
|
||||||
|
asp-route-id=E>
|
||||||
|
E
|
||||||
|
</a>
|
||||||
|
<a asp-action=ByLetter
|
||||||
|
asp-controller=Computer
|
||||||
|
asp-route-id=R>
|
||||||
|
R
|
||||||
|
</a>
|
||||||
|
<a asp-action=ByLetter
|
||||||
|
asp-controller=Computer
|
||||||
|
asp-route-id=T>
|
||||||
|
T
|
||||||
|
</a>
|
||||||
|
<a asp-action=ByLetter
|
||||||
|
asp-controller=Computer
|
||||||
|
asp-route-id=Y>
|
||||||
|
Y
|
||||||
|
</a>
|
||||||
|
<a asp-action=ByLetter
|
||||||
|
asp-controller=Computer
|
||||||
|
asp-route-id=U>
|
||||||
|
U
|
||||||
|
</a>
|
||||||
|
<a asp-action=ByLetter
|
||||||
|
asp-controller=Computer
|
||||||
|
asp-route-id=I>
|
||||||
|
I
|
||||||
|
</a>
|
||||||
|
<a asp-action=ByLetter
|
||||||
|
asp-controller=Computer
|
||||||
|
asp-route-id=O>
|
||||||
|
O
|
||||||
|
</a>
|
||||||
|
<a asp-action=ByLetter
|
||||||
|
asp-controller=Computer
|
||||||
|
asp-route-id=P>
|
||||||
|
P
|
||||||
|
</a>
|
||||||
|
<br>
|
||||||
|
<a asp-action=ByLetter
|
||||||
|
asp-controller=Computer
|
||||||
|
asp-route-id=A>
|
||||||
|
A
|
||||||
|
</a>
|
||||||
|
<a asp-action=ByLetter
|
||||||
|
asp-controller=Computer
|
||||||
|
asp-route-id=S>
|
||||||
|
S
|
||||||
|
</a>
|
||||||
|
<a asp-action=ByLetter
|
||||||
|
asp-controller=Computer
|
||||||
|
asp-route-id=D>
|
||||||
|
D
|
||||||
|
</a>
|
||||||
|
<a asp-action=ByLetter
|
||||||
|
asp-controller=Computer
|
||||||
|
asp-route-id=F>
|
||||||
|
F
|
||||||
|
</a>
|
||||||
|
<a asp-action=ByLetter
|
||||||
|
asp-controller=Computer
|
||||||
|
asp-route-id=G>
|
||||||
|
G
|
||||||
|
</a>
|
||||||
|
<a asp-action=ByLetter
|
||||||
|
asp-controller=Computer
|
||||||
|
asp-route-id=H>
|
||||||
|
H
|
||||||
|
</a>
|
||||||
|
<a asp-action=ByLetter
|
||||||
|
asp-controller=Computer
|
||||||
|
asp-route-id=J>
|
||||||
|
J
|
||||||
|
</a>
|
||||||
|
<a asp-action=ByLetter
|
||||||
|
asp-controller=Computer
|
||||||
|
asp-route-id=K>
|
||||||
|
K
|
||||||
|
</a>
|
||||||
|
<a asp-action=ByLetter
|
||||||
|
asp-controller=Computer
|
||||||
|
asp-route-id=L>
|
||||||
|
L
|
||||||
|
</a>
|
||||||
|
<br>
|
||||||
|
<a asp-action=ByLetter
|
||||||
|
asp-controller=Computer
|
||||||
|
asp-route-id=Z>
|
||||||
|
Z
|
||||||
|
</a>
|
||||||
|
<a asp-action=ByLetter
|
||||||
|
asp-controller=Computer
|
||||||
|
asp-route-id=X>
|
||||||
|
X
|
||||||
|
</a>
|
||||||
|
<a asp-action=ByLetter
|
||||||
|
asp-controller=Computer
|
||||||
|
asp-route-id=C>
|
||||||
|
C
|
||||||
|
</a>
|
||||||
|
<a asp-action=ByLetter
|
||||||
|
asp-controller=Computer
|
||||||
|
asp-route-id=V>
|
||||||
|
V
|
||||||
|
</a>
|
||||||
|
<a asp-action=ByLetter
|
||||||
|
asp-controller=Computer
|
||||||
|
asp-route-id=B>
|
||||||
|
B
|
||||||
|
</a>
|
||||||
|
<a asp-action=ByLetter
|
||||||
|
asp-controller=Computer
|
||||||
|
asp-route-id=N>
|
||||||
|
N
|
||||||
|
</a>
|
||||||
|
<a asp-action=ByLetter
|
||||||
|
asp-controller=Computer
|
||||||
|
asp-route-id=M>
|
||||||
|
M
|
||||||
|
</a>
|
||||||
|
<br>
|
||||||
|
<a asp-action=ByLetter
|
||||||
|
asp-controller=Computer>
|
||||||
|
All computers
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
Search by year
|
||||||
|
<br>
|
||||||
|
@{ int counter = 0; }
|
||||||
|
@for(int i = ViewBag.MinYear; i <= ViewBag.MaxYear; i++)
|
||||||
|
{
|
||||||
|
{
|
||||||
|
counter++;
|
||||||
|
}
|
||||||
|
<a asp-action=ByYear
|
||||||
|
asp-controller=Computer
|
||||||
|
asp-route-id=@i>
|
||||||
|
@i
|
||||||
|
</a>
|
||||||
|
if(counter % 8 == 0) { <br /> }
|
||||||
|
}
|
||||||
|
</p>
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
@using System.Reflection
|
@using Microsoft.Extensions.PlatformAbstractions
|
||||||
@{
|
@{
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
// Canary Islands Computer Museum Website
|
// Canary Islands Computer Museum Website
|
||||||
@@ -96,8 +96,9 @@
|
|||||||
</a>
|
</a>
|
||||||
<div aria-labelledby=navbarDropdown
|
<div aria-labelledby=navbarDropdown
|
||||||
class=dropdown-menu>
|
class=dropdown-menu>
|
||||||
<a class=dropdown-item
|
<a asp-action=Index
|
||||||
href=#>
|
asp-controller=Computer
|
||||||
|
class=dropdown-item>
|
||||||
Computers
|
Computers
|
||||||
</a>
|
</a>
|
||||||
<div class=dropdown-divider>
|
<div class=dropdown-divider>
|
||||||
@@ -131,7 +132,7 @@
|
|||||||
@RenderBody()
|
@RenderBody()
|
||||||
<hr />
|
<hr />
|
||||||
<footer>
|
<footer>
|
||||||
<p>© 2018 Natalia Portillo, @(Microsoft.Extensions.PlatformAbstractions.PlatformServices.Default.Application.ApplicationVersion)</p>
|
<p>© 2018 Natalia Portillo, @(PlatformServices.Default.Application.ApplicationVersion)</p>
|
||||||
</footer>
|
</footer>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||||
<Version>3.0.99.41</Version>
|
<Version>3.0.99.54</Version>
|
||||||
<Company>Canary Islands Computer Museum</Company>
|
<Company>Canary Islands Computer Museum</Company>
|
||||||
<Copyright>Copyright © 2003-2018 Natalia Portillo</Copyright>
|
<Copyright>Copyright © 2003-2018 Natalia Portillo</Copyright>
|
||||||
<Product>Canary Islands Computer Museum Website</Product>
|
<Product>Canary Islands Computer Museum Website</Product>
|
||||||
|
|||||||
Reference in New Issue
Block a user