diff --git a/Marechai/Areas/Admin/Views/Screens/Index.cshtml b/Marechai/Areas/Admin/Views/Screens/Index.cshtml deleted file mode 100644 index b9c6cf64..00000000 --- a/Marechai/Areas/Admin/Views/Screens/Index.cshtml +++ /dev/null @@ -1,60 +0,0 @@ -@model IEnumerable - -@{ - ViewData["Title"] = "Index"; -} -

Screens

-

- - Create new - -

- - - - - - - - - - - - @foreach (var item in Model) - { - - - - - - - - } - -
- @Html.DisplayNameFor(model => model.Diagonal) - - @Html.DisplayNameFor(model => model.NativeResolution) - - @Html.DisplayNameFor(model => model.EffectiveColors) - - @Html.DisplayNameFor(model => model.Type) -
- @Html.DisplayFor(modelItem => item.Diagonal) - - @item.NativeResolution.ToString() - - @Html.DisplayFor(modelItem => item.EffectiveColors) - - @Html.DisplayFor(modelItem => item.Type) - - - Details - - - Edit - - - Delete - -
\ No newline at end of file diff --git a/Marechai/Marechai.csproj b/Marechai/Marechai.csproj index cba2f9bd..9b2c99c3 100644 --- a/Marechai/Marechai.csproj +++ b/Marechai/Marechai.csproj @@ -2,7 +2,7 @@ netcoreapp3.1 - 3.0.99.1063 + 3.0.99.1067 Canary Islands Computer Museum Copyright © 2003-2020 Natalia Portillo Canary Islands Computer Museum Website @@ -76,6 +76,9 @@ true + + true + <_ContentIncludedByDefault Remove="Areas\Admin\Views\BrowserTests\Delete.cshtml" /> diff --git a/Marechai/Pages/Admin/Index.razor b/Marechai/Pages/Admin/Index.razor index 223fe265..39ab93fd 100644 --- a/Marechai/Pages/Admin/Index.razor +++ b/Marechai/Pages/Admin/Index.razor @@ -74,6 +74,9 @@
  • @L["Processors"]
  • +
  • + @L["Screens"] +
  • diff --git a/Marechai/Pages/Admin/Screens.razor b/Marechai/Pages/Admin/Screens.razor new file mode 100644 index 00000000..81b604cf --- /dev/null +++ b/Marechai/Pages/Admin/Screens.razor @@ -0,0 +1,108 @@ +@{ +/****************************************************************************** +// MARECHAI: Master repository of computing history artifacts information +// ---------------------------------------------------------------------------- +// +// Filename : Screens.razor +// Author(s) : Natalia Portillo +// +// --[ Description ] ---------------------------------------------------------- +// +// List of screens +// +// --[ 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 . +// +// ---------------------------------------------------------------------------- +// Copyright © 2003-2020 Natalia Portillo +*******************************************************************************/ +} + +@page "/admin/screens" +@using Marechai.Database.Models +@inherits OwningComponentBase +@inject IStringLocalizer L +@attribute [Authorize(Roles = "UberAdmin, Admin")] +

    @L["Screens"]

    +@if (_screens is null) +{ +

    @L["Loading..."]

    + + return; +} +

    + + @L["Create new"] + +

    + + + + + + + + + + + + @foreach (var item in _screens) + { + + + + + + + + } + +
    + @L["Diagonal"] + + @L["Native resolution"] + + @L["Effective colors"] + + @L["Type"] +
    + @string.Format(L["{0}\""], item.Diagonal) + + @item.NativeResolution.ToString() + + @item.EffectiveColors + + @item.Type + + + @L["Details"] + + + @L["Edit"] + + + @L["Delete"] + +
    + +@code +{ + List _screens; + + protected override void OnInitialized() + { + _screens = Service.Get(); + } +} \ No newline at end of file diff --git a/Marechai/Resources/Services/AdminService.es.resx b/Marechai/Resources/Services/AdminService.es.resx index 111ebae6..a49cedde 100644 --- a/Marechai/Resources/Services/AdminService.es.resx +++ b/Marechai/Resources/Services/AdminService.es.resx @@ -198,4 +198,8 @@ Procesadores Processors. + + Pantallas + Screens. + \ No newline at end of file diff --git a/Marechai/Resources/Services/ScreensService.es.resx b/Marechai/Resources/Services/ScreensService.es.resx new file mode 100644 index 00000000..476ed909 --- /dev/null +++ b/Marechai/Resources/Services/ScreensService.es.resx @@ -0,0 +1,165 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Pantallas + Screens + + + Cargando... + Message that appears while data is being loaded from database + + + Diagonal + Diagonal + + + Resolución nativa + Native resolution + + + Colores + Effective colors + + + Tipo + Type + + + {0}" + {0} as number of inches accompanied by inches symbol or name + + + Crear nueva + Create new + + + Detalles + Details + + + Editar + Edit + + + Eliminar + Delete + + \ No newline at end of file diff --git a/Marechai/Services/Register.cs b/Marechai/Services/Register.cs index d1255270..7fecc40a 100644 --- a/Marechai/Services/Register.cs +++ b/Marechai/Services/Register.cs @@ -57,6 +57,7 @@ namespace Marechai.Services services.AddScoped(); services.AddScoped(); services.AddScoped(); + services.AddScoped(); } } } \ No newline at end of file diff --git a/Marechai/Services/ScreensService.cs b/Marechai/Services/ScreensService.cs new file mode 100644 index 00000000..b1af614c --- /dev/null +++ b/Marechai/Services/ScreensService.cs @@ -0,0 +1,17 @@ +using System.Collections.Generic; +using System.Linq; +using Marechai.Database.Models; + +namespace Marechai.Services +{ + public class ScreensService + { + readonly MarechaiContext _context; + + public ScreensService(MarechaiContext context) => _context = context; + + public List Get() => _context.Screens.AsEnumerable().OrderBy(s => s.Diagonal). + ThenBy(s => s.EffectiveColors).ThenBy(s => s.NativeResolution.ToString()). + ThenBy(s => s.Type).ThenBy(s => s.Size).ToList(); + } +} \ No newline at end of file