Sort resolutions in admin page.

This commit is contained in:
2019-05-19 01:26:16 +01:00
parent f6b236cd10
commit 530869f2e0
6 changed files with 42 additions and 12 deletions

View File

@@ -29,6 +29,7 @@
*******************************************************************************/ *******************************************************************************/
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
namespace Cicm.Database.Models namespace Cicm.Database.Models
{ {
@@ -44,8 +45,11 @@ namespace Cicm.Database.Models
public int Height { get; set; } public int Height { get; set; }
public long? Colors { get; set; } public long? Colors { get; set; }
public long? Palette { get; set; } public long? Palette { get; set; }
public bool Chars { get; set; } [DisplayName("Character based")]
public bool Chars { get; set; }
public virtual ICollection<ResolutionsByGpu> ResolutionsByGpu { get; set; } public virtual ICollection<ResolutionsByGpu> ResolutionsByGpu { get; set; }
public long? PaletteView => Palette ?? Colors;
} }
} }

View File

@@ -49,7 +49,9 @@ namespace cicm_web.Areas.Admin.Controllers
} }
// GET: Admin/Resolutions // GET: Admin/Resolutions
public async Task<IActionResult> Index() => View(await _context.Resolutions.ToListAsync()); public async Task<IActionResult> Index() =>
View(await _context.Resolutions.OrderBy(r => r.Chars).ThenBy(r => r.Width).ThenBy(r => r.Height)
.ThenBy(r => r.Colors).ToListAsync());
// GET: Admin/Resolutions/Details/5 // GET: Admin/Resolutions/Details/5
public async Task<IActionResult> Details(int? id) public async Task<IActionResult> Details(int? id)

View File

@@ -45,6 +45,26 @@
<div asp-validation-summary="ModelOnly" <div asp-validation-summary="ModelOnly"
class="text-danger"> class="text-danger">
</div> </div>
<div class="form-group">
<label asp-for="Width"
class="control-label">
</label>
<input asp-for="Width"
class="form-control" />
<span asp-validation-for="Width"
class="text-danger">
</span>
</div>
<div class="form-group">
<label asp-for="Height"
class="control-label">
</label>
<input asp-for="Height"
class="form-control" />
<span asp-validation-for="Height"
class="text-danger">
</span>
</div>
<div class="form-group"> <div class="form-group">
<label asp-for="Colors" <label asp-for="Colors"
class="control-label"> class="control-label">
@@ -65,6 +85,13 @@
class="text-danger"> class="text-danger">
</span> </span>
</div> </div>
<div class="form-group">
<div class="checkbox">
<label>
<input asp-for="Chars" /> @Html.DisplayNameFor(model => model.Chars)
</label>
</div>
</div>
<div class="form-group"> <div class="form-group">
<input class="btn btn-primary" <input class="btn btn-primary"
type="submit" type="submit"

View File

@@ -88,14 +88,11 @@
</span> </span>
</div> </div>
<div class="form-group"> <div class="form-group">
<label asp-for="Chars" <div class="checkbox">
class="control-label"> <label>
</label> <input asp-for="Chars" /> @Html.DisplayNameFor(model => model.Chars)
<input asp-for="Chars" </label>
class="form-control" /> </div>
<span asp-validation-for="Chars"
class="text-danger">
</span>
</div> </div>
<div class="form-group"> <div class="form-group">
<input class="btn btn-primary" <input class="btn btn-primary"

View File

@@ -79,7 +79,7 @@
@Html.DisplayFor(modelItem => item.Colors) @Html.DisplayFor(modelItem => item.Colors)
</td> </td>
<td> <td>
@Html.DisplayFor(modelItem => item.Palette) @Html.DisplayFor(modelItem => item.PaletteView)
</td> </td>
<td> <td>
@Html.DisplayFor(modelItem => item.Chars) @Html.DisplayFor(modelItem => item.Chars)

View File

@@ -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.449</Version> <Version>3.0.99.450</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>