mirror of
https://github.com/claunia/marechai.git
synced 2025-12-16 19:14:25 +00:00
Optimize view of memory by machine admin page.
This commit is contained in:
@@ -31,6 +31,7 @@
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Cicm.Database.Models;
|
||||
using cicm_web.Areas.Admin.Models;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.Rendering;
|
||||
@@ -56,7 +57,16 @@ namespace cicm_web.Areas.Admin.Controllers
|
||||
IIncludableQueryable<MemoryByMachine, Machine> cicmContext =
|
||||
_context.MemoryByMachine.Include(m => m.Machine);
|
||||
return View(await cicmContext.OrderBy(m => m.Machine.Name).ThenBy(m => m.Usage).ThenBy(m => m.Size)
|
||||
.ThenBy(m => m.Type).ToListAsync());
|
||||
.ThenBy(m => m.Type)
|
||||
.Select(m => new MemoryByMachineViewModel
|
||||
{
|
||||
Id = m.Id,
|
||||
Machine = m.Machine.Name,
|
||||
Size = m.Size,
|
||||
Speed = m.Speed,
|
||||
Type = m.Type,
|
||||
Usage = m.Usage
|
||||
}).ToListAsync());
|
||||
}
|
||||
|
||||
// GET: Admin/MemoryByMachines/Details/5
|
||||
|
||||
47
cicm_web/Areas/Admin/Models/MemoryByMachine.cs
Normal file
47
cicm_web/Areas/Admin/Models/MemoryByMachine.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
/******************************************************************************
|
||||
// Canary Islands Computer Museum Website
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// Filename : MemoryByMachine.cs
|
||||
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
||||
//
|
||||
// --[ Description ] ----------------------------------------------------------
|
||||
//
|
||||
// Junction between memory and machine.
|
||||
//
|
||||
// --[ 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
|
||||
*******************************************************************************/
|
||||
|
||||
using System.ComponentModel;
|
||||
using Cicm.Database;
|
||||
|
||||
namespace cicm_web.Areas.Admin.Models
|
||||
{
|
||||
public class MemoryByMachineViewModel
|
||||
{
|
||||
public long Id;
|
||||
public MemoryType Type { get; set; }
|
||||
public MemoryUsage Usage { get; set; }
|
||||
public long? Size { get; set; }
|
||||
[DisplayName("Speed (Hz)")]
|
||||
public double? Speed { get; set; }
|
||||
|
||||
public string Machine { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -29,8 +29,8 @@
|
||||
// Copyright © 2003-2018 Natalia Portillo
|
||||
*******************************************************************************/
|
||||
}
|
||||
@using Cicm.Database.Models
|
||||
@model IEnumerable<Cicm.Database.Models.MemoryByMachine>
|
||||
@using cicm_web.Areas.Admin.Models
|
||||
@model IEnumerable<cicm_web.Areas.Admin.Models.MemoryByMachineViewModel>
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Memory by machines (Admin)";
|
||||
@@ -66,11 +66,11 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach(MemoryByMachine item in Model)
|
||||
@foreach(MemoryByMachineViewModel item in Model)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Machine.Name)
|
||||
@Html.DisplayFor(modelItem => item.Machine)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Usage)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.2</TargetFramework>
|
||||
<Version>3.0.99.538</Version>
|
||||
<Version>3.0.99.539</Version>
|
||||
<Company>Canary Islands Computer Museum</Company>
|
||||
<Copyright>Copyright © 2003-2018 Natalia Portillo</Copyright>
|
||||
<Product>Canary Islands Computer Museum Website</Product>
|
||||
|
||||
Reference in New Issue
Block a user