Add console controller and views.

This commit is contained in:
2018-04-15 02:31:23 +01:00
parent a558c139b0
commit 3ded57a24d
14 changed files with 1302 additions and 10 deletions

View File

@@ -0,0 +1,57 @@
@{
/******************************************************************************
// Canary Islands Computer Museum Website
// ----------------------------------------------------------------------------
//
// Filename : ByLetter.cshtml
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// --[ 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 <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2003-2018 Natalia Portillo
*******************************************************************************/
ViewData["Title"] = "Consoles";
}
@model IEnumerable<ConsoleMini>
<p>Search results:</p>
<p align="center">
@if(ViewBag.Letter != '\0')
{
<b>@ViewBag.Letter</b><br/>
}
@if(Model.Any())
{
<p>@Model.Count() computers found in the database.<br />
@foreach(ConsoleMini console in @Model)
{
<a asp-controller="Console" asp-action="View" asp-route-id="@console.Id">@console.Company.Name @console.Name</a><br/>
}
</p>
}
else
{
<p>There are no videoconsoles found in the database that start with this letter.</p>
}
</p>

View File

@@ -0,0 +1,59 @@
@{
/******************************************************************************
// Canary Islands Computer Museum Website
// ----------------------------------------------------------------------------
//
// Filename : ByYear.cshtml
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// --[ 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 <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2003-2018 Natalia Portillo
*******************************************************************************/
ViewData["Title"] = "Computers";
}
@model IEnumerable<ConsoleMini>
<p>Search results:</p>
<p align=center>
<b>@ViewBag.Year</b><br />
@if(Model.Any())
{
<p>
@Model.Count() videoconsoles found in the database.<br />
@foreach(ConsoleMini console in Model)
{
<a asp-controller="Console"
asp-action="View"
asp-route-id="@console.Id">
@console.Company.Name @console.Name</a>
<br />
}
</p>
}
else
{
<p>There are no videoconsoles found in the database released this year.</p>
}
</p>

View 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"] = "Videoconsoles";
}
<p>
Here you can consult our database.<br />
In this database you can find technical information as well as videoconsoles history, catalogued by companies, alfabetically and by release date.<br />
@ViewBag.ItemCount videoconsoles actually catalogued in the database.
</p>
<p>
<br>
<br>
Search by companies
<br>
<a asp-action=ByLetter
asp-controller=ConsoleCompany
asp-route-id=Q>
Q
</a>
<a asp-action=ByLetter
asp-controller=ConsoleCompany
asp-route-id=W>
W
</a>
<a asp-action=ByLetter
asp-controller=ConsoleCompany
asp-route-id=E>
E
</a>
<a asp-action=ByLetter
asp-controller=ConsoleCompany
asp-route-id=R>
R
</a>
<a asp-action=ByLetter
asp-controller=ConsoleCompany
asp-route-id=T>
T
</a>
<a asp-action=ByLetter
asp-controller=ConsoleCompany
asp-route-id=Y>
Y
</a>
<a asp-action=ByLetter
asp-controller=ConsoleCompany
asp-route-id=U>
U
</a>
<a asp-action=ByLetter
asp-controller=ConsoleCompany
asp-route-id=I>
I
</a>
<a asp-action=ByLetter
asp-controller=ConsoleCompany
asp-route-id=O>
O
</a>
<a asp-action=ByLetter
asp-controller=ConsoleCompany
asp-route-id=P>
P
</a>
<br>
<a asp-action=ByLetter
asp-controller=ConsoleCompany
asp-route-id=A>
A
</a>
<a asp-action=ByLetter
asp-controller=ConsoleCompany
asp-route-id=S>
S
</a>
<a asp-action=ByLetter
asp-controller=ConsoleCompany
asp-route-id=D>
D
</a>
<a asp-action=ByLetter
asp-controller=ConsoleCompany
asp-route-id=F>
F
</a>
<a asp-action=ByLetter
asp-controller=ConsoleCompany
asp-route-id=G>
G
</a>
<a asp-action=ByLetter
asp-controller=ConsoleCompany
asp-route-id=H>
H
</a>
<a asp-action=ByLetter
asp-controller=ConsoleCompany
asp-route-id=J>
J
</a>
<a asp-action=ByLetter
asp-controller=ConsoleCompany
asp-route-id=K>
K
</a>
<a asp-action=ByLetter
asp-controller=ConsoleCompany
asp-route-id=L>
L
</a>
<br>
<a asp-action=ByLetter
asp-controller=ConsoleCompany
asp-route-id=Z>
Z
</a>
<a asp-action=ByLetter
asp-controller=ConsoleCompany
asp-route-id=X>
X
</a>
<a asp-action=ByLetter
asp-controller=ConsoleCompany
asp-route-id=C>
C
</a>
<a asp-action=ByLetter
asp-controller=ConsoleCompany
asp-route-id=V>
V
</a>
<a asp-action=ByLetter
asp-controller=ConsoleCompany
asp-route-id=B>
B
</a>
<a asp-action=ByLetter
asp-controller=ConsoleCompany
asp-route-id=N>
N
</a>
<a asp-action=ByLetter
asp-controller=ConsoleCompany
asp-route-id=M>
M
</a>
<br>
<a asp-action=ByLetter
asp-controller=ConsoleCompany>
All companies
</a>
</p>
<p>
Alfabetically search
<br>
<a asp-action=ByLetter
asp-controller=Console
asp-route-id=Q>
Q
</a>
<a asp-action=ByLetter
asp-controller=Console
asp-route-id=W>
W
</a>
<a asp-action=ByLetter
asp-controller=Console
asp-route-id=E>
E
</a>
<a asp-action=ByLetter
asp-controller=Console
asp-route-id=R>
R
</a>
<a asp-action=ByLetter
asp-controller=Console
asp-route-id=T>
T
</a>
<a asp-action=ByLetter
asp-controller=Console
asp-route-id=Y>
Y
</a>
<a asp-action=ByLetter
asp-controller=Console
asp-route-id=U>
U
</a>
<a asp-action=ByLetter
asp-controller=Console
asp-route-id=I>
I
</a>
<a asp-action=ByLetter
asp-controller=Console
asp-route-id=O>
O
</a>
<a asp-action=ByLetter
asp-controller=Console
asp-route-id=P>
P
</a>
<br>
<a asp-action=ByLetter
asp-controller=Console
asp-route-id=A>
A
</a>
<a asp-action=ByLetter
asp-controller=Console
asp-route-id=S>
S
</a>
<a asp-action=ByLetter
asp-controller=Console
asp-route-id=D>
D
</a>
<a asp-action=ByLetter
asp-controller=Console
asp-route-id=F>
F
</a>
<a asp-action=ByLetter
asp-controller=Console
asp-route-id=G>
G
</a>
<a asp-action=ByLetter
asp-controller=Console
asp-route-id=H>
H
</a>
<a asp-action=ByLetter
asp-controller=Console
asp-route-id=J>
J
</a>
<a asp-action=ByLetter
asp-controller=Console
asp-route-id=K>
K
</a>
<a asp-action=ByLetter
asp-controller=Console
asp-route-id=L>
L
</a>
<br>
<a asp-action=ByLetter
asp-controller=Console
asp-route-id=Z>
Z
</a>
<a asp-action=ByLetter
asp-controller=Console
asp-route-id=X>
X
</a>
<a asp-action=ByLetter
asp-controller=Console
asp-route-id=C>
C
</a>
<a asp-action=ByLetter
asp-controller=Console
asp-route-id=V>
V
</a>
<a asp-action=ByLetter
asp-controller=Console
asp-route-id=B>
B
</a>
<a asp-action=ByLetter
asp-controller=Console
asp-route-id=N>
N
</a>
<a asp-action=ByLetter
asp-controller=Console
asp-route-id=M>
M
</a>
<br>
<a asp-action=ByLetter
asp-controller=Console>
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=Console
asp-route-id=@i>
@i
</a>
if(counter % 8 == 0) { <br /> }
}
</p>

View File

@@ -0,0 +1,447 @@
@{
/******************************************************************************
// Canary Islands Computer Museum Website
// ----------------------------------------------------------------------------
//
// Filename : Index.cshtml
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// --[ 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 <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// 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")))
{
<img src="@(System.IO.Path.Combine("/assets/logos/consoles", Model.Company.Id + ".gif"))"
alt="">
}
@if(File.Exists(System.IO.Path.Combine(ViewBag.WebRootPath, "assets/logos/consoles", Model.Company.Id + ".jpg")))
{
<img src="@(System.IO.Path.Combine("/assets/logos/consoles", Model.Company.Id + ".jpg"))"
alt="">
}
@if(File.Exists(System.IO.Path.Combine(ViewBag.WebRootPath, "assets/logos/consoles", Model.Company.Id + ".png")))
{
<img src="@(System.IO.Path.Combine("/assets/logos/consoles", Model.Company.Id + ".png"))"
alt="">
}
@if(Model.Year == 1000)
{
<b>
<center>PROTOTYPE</center>
</b>
}
<b>@Model.Company.Name @Model.Name</b>
<table border=0
width=100%>
@if(Model.Year != 1000)
{
<tr>
<th scope=row
width="37%">
<div align=right>
Year
</div>
</th>
<td width="63%">
@Model.Year
</td>
</tr>
}
<tr>
<th scope=row>
<div align=right>
Primary processor
</div>
</th>
@if(Model.Cpu1.Id != 4)
{
if(Model.Cpu1.Id != 5)
{
if(Model.Mhz1 > 0)
{
if(Model.Bits > 0)
{
<td>@Model.Cpu1.Name @("@") @($"{Model.Mhz1}Mhz") (@Model.Bits bits)</td>
}
else
{
<td>@Model.Cpu1.Name @("@") @($"{Model.Mhz1}Mhz")</td>
}
}
else
{
<td>@Model.Cpu1.Name</td>
}
}
else
{
<td>Unknown data</td>
}
}
else
{ <td>None</td> }
</tr>
@if(Model.Cpu2 != null)
{
<tr>
<th scope=row>
<div align=right>
Secondary processor
</div>
</th>
@if(Model.Cpu2.Id != 4)
{
if(Model.Cpu2.Id != 5)
{
if(Model.Mhz2 > 0)
{
if(Model.Bits > 0)
{
<td>@Model.Cpu2.Name @("@") @($"{Model.Mhz2}Mhz") (@Model.Bits bits)</td>
}
else
{
<td>@Model.Cpu2.Name @("@") @($"{Model.Mhz2}Mhz")</td>
}
}
else
{
<td>@Model.Cpu2.Name</td>
}
}
else
{
<td>Unknown data</td>
}
}
else
{ <td>None</td> }
</tr>
}
<tr>
<th scope=row>
<div align=right>
RAM
</div>
</th>
@if(Model.Ram > 1024)
{
if(Model.Ram > 1048576)
{
<td>@($"{Model.Ram / 1048576}") Gbytes</td>
}
else
{
<td>@($"{Model.Ram / 1024}") Mbytes</td>
}
}
else
{
if(Model.Ram == 0)
{
<td>Unknown data</td>
}
else
{
<td>@Model.Ram Kbytes</td>
}
}
</tr>
<tr>
<th scope=row>
<div align=right>
ROM
</div>
</th>
@if(Model.Rom > 1024)
{
if(Model.Rom > 1048576)
{
<td>@($"{Model.Rom / 1048576}") Gbytes</td>
}
else
{
<td>@($"{Model.Rom / 1024}") Mbytes</td>
}
}
else
{
if(Model.Rom == 0)
{
<td>Unknown data</td>
}
else
{
<td>@Model.Rom Kbytes</td>
}
}
</tr>
<tr>
<th scope=row>
<div align=right>
Graphics processor
</div>
</th>
@if(Model.Gpu.Id > 1)
{
if(Model.Gpu.Id > 2)
{
<td>@Model.Gpu.Name</td>
}
else
{
<td>Unknown data</td>
}
}
else
{ <td>None</td> }
</tr>
<tr>
<th scope=row>
<div align=right>
Video memory
</div>
</th>
@if(Model.Vram > 1024)
{
if(Model.Vram > 1048576)
{
<td>@($"{Model.Vram / 1048576}") Gbytes</td>
}
else
{
<td>@($"{Model.Vram / 1024}") Mbytes</td>
}
}
else
{
if(Model.Vram == 0)
{
<td>Unknown data</td>
}
else
{
<td>@Model.Vram Kbytes</td>
}
}
</tr>
<tr>
<th scope=row>
<div align=right>
Video resolution
</div>
</th>
@if(Model.Resolution != "???")
{
<td>@Model.Resolution</td>
}
else
{
<td>Unknown data</td>
}
</tr>
<tr>
<th scope=row>
<div align=right>
Colors
</div>
</th>
@if(Model.Colors > 0)
{
if(Model.Palette > 0)
{
<td>@Model.Colors from a palette of @Model.Palette</td>
}
else
{
<td>@Model.Colors</td>
}
}
else
{
<td>Unknown data</td>
}
</tr>
<tr>
<th scope=row>
<div align=right>
Sound processor
</div>
</th>
@if(Model.Spu.Id > 1)
{
if(Model.Spu.Id > 2)
{
if(Model.SoundChannels > 0)
{
<td>@Model.Spu.Name (@Model.SoundChannels channels)</td>
}
else
{
<td>@Model.Spu.Name</td>
}
}
else
{
<td>Unknown data</td>
}
}
else
{ <td>None</td> }
</tr>
<tr>
<th scope=row>
<div align=right>
Music synthetizer
</div>
</th>
@if(Model.Mpu.Id > 1)
{
if(Model.Mpu.Id > 2)
{
if(Model.MusicChannels > 0)
{
<td>@Model.Mpu.Name (@Model.MusicChannels channels)</td>
}
else
{
<td>@Model.Mpu.Name</td>
}
}
else
{
<td>Unknown data</td>
}
}
else
{ <td>None</td> }
</tr>
@if(Model.Format != null)
{
<tr>
<th scope=row>
<div align=right>
Primary disk
</div>
</th>
@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)
{
<td>@Model.Format.Description (@cap1Bytes)</td>
}
else
{
<td>Propietary (@cap1Bytes)</td>
}
}
else
{
<td>Digital tape (@cap1Bytes)</td>
}
}
else
{
<td>Punched card (@cap1Bytes)</td>
}
}
else
{
<td>Chip card (@cap1Bytes)</td>
}
}
else
{
<td>Magnetic card (@cap1Bytes)</td>
}
}
else
{
<td>Memory (@cap1Bytes)</td>
}
}
else
{
<td>Magneto-optical (@cap1Bytes)</td>
}
}
else
{
<td>Optical disk (@cap1Bytes)</td>
}
}
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");
<td>Cartridge (@cap1Bits)</td>
}
}
else
{
<td>Standard audio cassette (@Model.Cap bps)</td>
}
}
else
{ <td>None</td> }
</tr>
}
</table>
@if(File.Exists(System.IO.Path.Combine(ViewBag.WebRootPath, "assets/photos/consoles", Model.Id + ".jpg")))
{
<img src="@System.IO.Path.Combine("/assets/photos/consoles", Model.Id + ".jpg")"
alt="">
}