Implement list admin page for resolutions by screen.

This commit is contained in:
2019-06-02 01:00:03 +01:00
parent a77c0d4912
commit 598a2dff19
4 changed files with 21 additions and 11 deletions

View File

@@ -42,5 +42,8 @@ namespace Cicm.Database.Models
public virtual ICollection<ScreensByMachine> ScreensByMachines { get; set; }
[Required]
public int NativeResolutionId { get; set; }
public override string ToString() =>
NativeResolution != null ? $"{Diagonal}\" {Type} at {NativeResolution}" : $"{Diagonal}\" {Type}";
}
}

View File

@@ -25,7 +25,8 @@ namespace cicm_web.Areas.Admin.Controllers
{
IIncludableQueryable<ResolutionsByScreen, Screen> cicmContext =
_context.ResolutionsByScreen.Include(r => r.Resolution).Include(r => r.Screen);
return View(await cicmContext.ToListAsync());
return View(await cicmContext.OrderBy(r => r.Screen.ToString()).ThenBy(r => r.Resolution.ToString())
.ToListAsync());
}
// GET: ResolutionsByScreen/Details/5

View File

@@ -5,10 +5,13 @@
ViewData["Title"] = "Index";
}
<h1>Index</h1>
<h1>Resolutions by screen</h1>
<p>
<a asp-action="Create">Create New</a>
<a asp-action="Create"
class="btn btn-primary">
Create New
</a>
</p>
<table class="table">
<thead>
@@ -33,16 +36,19 @@
@Html.DisplayFor(modelItem => item.Resolution.Id)
</td>
<td>
<a asp-action="Edit"
asp-route-id="@item.Id">
Edit
</a> |
<a asp-action="Details"
asp-route-id="@item.Id">
asp-route-id="@item.Id"
class="btn btn-primary">
Details
</a> |
</a>
<a asp-action="Edit"
asp-route-id="@item.Id"
class="btn btn-secondary">
Edit
</a>
<a asp-action="Delete"
asp-route-id="@item.Id">
asp-route-id="@item.Id"
class="btn btn-danger">
Delete
</a>
</td>

View File

@@ -2,7 +2,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<Version>3.0.99.730</Version>
<Version>3.0.99.732</Version>
<Company>Canary Islands Computer Museum</Company>
<Copyright>Copyright © 2003-2018 Natalia Portillo</Copyright>
<Product>Canary Islands Computer Museum Website</Product>