mirror of
https://github.com/claunia/marechai.git
synced 2025-12-16 19:14:25 +00:00
Implement page for listing screens.
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
@@ -7,14 +8,18 @@ namespace Cicm.Database.Models
|
|||||||
public class Screen : BaseModel<int>
|
public class Screen : BaseModel<int>
|
||||||
{
|
{
|
||||||
[Range(1, 131072)]
|
[Range(1, 131072)]
|
||||||
|
[DisplayName("Width (mm)")]
|
||||||
public double? Width { get; set; }
|
public double? Width { get; set; }
|
||||||
[Range(1, 131072)]
|
[Range(1, 131072)]
|
||||||
|
[DisplayName("Height (mm)")]
|
||||||
public double? Height { get; set; }
|
public double? Height { get; set; }
|
||||||
[Required]
|
[Required]
|
||||||
|
[DisplayName("Diagonal (inches)")]
|
||||||
public double Diagonal { get; set; }
|
public double Diagonal { get; set; }
|
||||||
[Required]
|
[Required]
|
||||||
public virtual Resolution NativeResolution { get; set; }
|
public virtual Resolution NativeResolution { get; set; }
|
||||||
[Range(2, 281474976710656)]
|
[Range(2, 281474976710656)]
|
||||||
|
[DisplayName("Effective colors")]
|
||||||
public long? EffectiveColors { get; set; }
|
public long? EffectiveColors { get; set; }
|
||||||
[Required]
|
[Required]
|
||||||
public string Type { get; set; }
|
public string Type { get; set; }
|
||||||
@@ -22,6 +27,17 @@ namespace Cicm.Database.Models
|
|||||||
[NotMapped]
|
[NotMapped]
|
||||||
public long? Colors => EffectiveColors ?? NativeResolution.Colors;
|
public long? Colors => EffectiveColors ?? NativeResolution.Colors;
|
||||||
|
|
||||||
|
[NotMapped]
|
||||||
|
public string Size
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if(Width != null && Height != null) return $"{Width}x{Height} mm";
|
||||||
|
|
||||||
|
return "Unknown";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public virtual ICollection<ResolutionsByScreen> Resolutions { get; set; }
|
public virtual ICollection<ResolutionsByScreen> Resolutions { get; set; }
|
||||||
public virtual ICollection<ScreensByMachine> ScreensByMachines { get; set; }
|
public virtual ICollection<ScreensByMachine> ScreensByMachines { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,9 @@ namespace cicm_web.Areas.Admin.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GET: Screens
|
// GET: Screens
|
||||||
public async Task<IActionResult> Index() => View(await _context.Screens.ToListAsync());
|
public async Task<IActionResult> Index() =>
|
||||||
|
View(await _context.Screens.OrderBy(s => s.Diagonal).ThenBy(s => s.EffectiveColors).ThenBy(s => s.Type)
|
||||||
|
.ThenBy(s => s.Size).ToListAsync());
|
||||||
|
|
||||||
// GET: Screens/Details/5
|
// GET: Screens/Details/5
|
||||||
public async Task<IActionResult> Details(int? id)
|
public async Task<IActionResult> Details(int? id)
|
||||||
|
|||||||
@@ -55,6 +55,9 @@
|
|||||||
<a asp-controller="Processors">Processors</a><br />
|
<a asp-controller="Processors">Processors</a><br />
|
||||||
<a asp-controller="Resolutions">Resolutions</a><br />
|
<a asp-controller="Resolutions">Resolutions</a><br />
|
||||||
<a asp-controller="ResolutionsByGpu">Resolutions by GPU</a><br />
|
<a asp-controller="ResolutionsByGpu">Resolutions by GPU</a><br />
|
||||||
|
<a asp-controller="ResolutionsByScreen">Resolutions by screen</a><br />
|
||||||
|
<a asp-controller="Screens">Screens</a><br />
|
||||||
|
<a asp-controller="ScreensByMachine">Screens by machine</a><br />
|
||||||
<a asp-controller="SoundSynths">Sound synthetizers</a><br />
|
<a asp-controller="SoundSynths">Sound synthetizers</a><br />
|
||||||
<a asp-controller="SoundByMachine">Sound synthetizers by machine</a><br />
|
<a asp-controller="SoundByMachine">Sound synthetizers by machine</a><br />
|
||||||
<a asp-controller="StorageByMachines">Storage by machines</a><br />
|
<a asp-controller="StorageByMachines">Storage by machines</a><br />
|
||||||
|
|||||||
@@ -5,23 +5,23 @@
|
|||||||
ViewData["Title"] = "Index";
|
ViewData["Title"] = "Index";
|
||||||
}
|
}
|
||||||
|
|
||||||
<h1>Index</h1>
|
<h1>Screens</h1>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<a asp-action="Create">Create New</a>
|
<a asp-action="Create"
|
||||||
|
class="btn btn-primary">
|
||||||
|
Create New
|
||||||
|
</a>
|
||||||
</p>
|
</p>
|
||||||
<table class="table">
|
<table class="table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>
|
|
||||||
@Html.DisplayNameFor(model => model.Width)
|
|
||||||
</th>
|
|
||||||
<th>
|
|
||||||
@Html.DisplayNameFor(model => model.Height)
|
|
||||||
</th>
|
|
||||||
<th>
|
<th>
|
||||||
@Html.DisplayNameFor(model => model.Diagonal)
|
@Html.DisplayNameFor(model => model.Diagonal)
|
||||||
</th>
|
</th>
|
||||||
|
<th>
|
||||||
|
@Html.DisplayNameFor(model => model.Size)
|
||||||
|
</th>
|
||||||
<th>
|
<th>
|
||||||
@Html.DisplayNameFor(model => model.EffectiveColors)
|
@Html.DisplayNameFor(model => model.EffectiveColors)
|
||||||
</th>
|
</th>
|
||||||
@@ -35,15 +35,12 @@
|
|||||||
@foreach(Screen item in Model)
|
@foreach(Screen item in Model)
|
||||||
{
|
{
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
|
||||||
@Html.DisplayFor(modelItem => item.Width)
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
@Html.DisplayFor(modelItem => item.Height)
|
|
||||||
</td>
|
|
||||||
<td>
|
<td>
|
||||||
@Html.DisplayFor(modelItem => item.Diagonal)
|
@Html.DisplayFor(modelItem => item.Diagonal)
|
||||||
</td>
|
</td>
|
||||||
|
<td>
|
||||||
|
@Html.DisplayFor(modelItem => item.Size)
|
||||||
|
</td>
|
||||||
<td>
|
<td>
|
||||||
@Html.DisplayFor(modelItem => item.EffectiveColors)
|
@Html.DisplayFor(modelItem => item.EffectiveColors)
|
||||||
</td>
|
</td>
|
||||||
@@ -51,16 +48,19 @@
|
|||||||
@Html.DisplayFor(modelItem => item.Type)
|
@Html.DisplayFor(modelItem => item.Type)
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a asp-action="Edit"
|
|
||||||
asp-route-id="@item.Id">
|
|
||||||
Edit
|
|
||||||
</a> |
|
|
||||||
<a asp-action="Details"
|
<a asp-action="Details"
|
||||||
asp-route-id="@item.Id">
|
asp-route-id="@item.Id"
|
||||||
|
class="btn btn-primary">
|
||||||
Details
|
Details
|
||||||
</a> |
|
</a>
|
||||||
|
<a asp-action="Edit"
|
||||||
|
asp-route-id="@item.Id"
|
||||||
|
class="btn btn-secondary">
|
||||||
|
Edit
|
||||||
|
</a>
|
||||||
<a asp-action="Delete"
|
<a asp-action="Delete"
|
||||||
asp-route-id="@item.Id">
|
asp-route-id="@item.Id"
|
||||||
|
class="btn btn-danger">
|
||||||
Delete
|
Delete
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
@@ -4,8 +4,5 @@
|
|||||||
"LogLevel": {
|
"LogLevel": {
|
||||||
"Default": "Warning"
|
"Default": "Warning"
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"ConnectionStrings": {
|
|
||||||
"cicmContext": "Server=(localdb)\\mssqllocaldb;Database=cicmContext-3ead5ce4-a116-44e6-a347-9791facb4ffc;Trusted_Connection=True;MultipleActiveResultSets=true"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netcoreapp2.2</TargetFramework>
|
<TargetFramework>netcoreapp2.2</TargetFramework>
|
||||||
<Version>3.0.99.715</Version>
|
<Version>3.0.99.721</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