mirror of
https://github.com/claunia/marechai.git
synced 2025-12-16 19:14:25 +00:00
Optimize view of processors 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;
|
||||
@@ -55,7 +56,14 @@ namespace cicm_web.Areas.Admin.Controllers
|
||||
{
|
||||
IIncludableQueryable<ProcessorsByMachine, Processor> cicmContext =
|
||||
_context.ProcessorsByMachine.Include(p => p.Machine).Include(p => p.Processor);
|
||||
return View(await cicmContext.OrderBy(p => p.Machine.Name).ThenBy(p => p.Processor.Name).ToListAsync());
|
||||
return View(await cicmContext.OrderBy(p => p.Machine.Name).ThenBy(p => p.Processor.Name)
|
||||
.Select(p => new ProcessorsByMachineViewModel
|
||||
{
|
||||
Id = p.Id,
|
||||
Machine = p.Machine.Name,
|
||||
Processor = p.Processor.Name,
|
||||
Speed = p.Speed
|
||||
}).ToListAsync());
|
||||
}
|
||||
|
||||
// GET: Admin/ProcessorsByMachines/Details/5
|
||||
|
||||
43
cicm_web/Areas/Admin/Models/ProcessorsByMachineViewModel.cs
Normal file
43
cicm_web/Areas/Admin/Models/ProcessorsByMachineViewModel.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
/******************************************************************************
|
||||
// Canary Islands Computer Museum Website
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// Filename : ProcessorByMachine.cs
|
||||
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
||||
//
|
||||
// --[ Description ] ----------------------------------------------------------
|
||||
//
|
||||
// Junction of processor 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;
|
||||
|
||||
namespace cicm_web.Areas.Admin.Models
|
||||
{
|
||||
public class ProcessorsByMachineViewModel
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public string Processor { get; set; }
|
||||
public string Machine { get; set; }
|
||||
[DisplayName("Speed (MHz)")]
|
||||
public float? Speed { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -29,8 +29,8 @@
|
||||
// Copyright © 2003-2018 Natalia Portillo
|
||||
*******************************************************************************/
|
||||
}
|
||||
@using Cicm.Database.Models
|
||||
@model IEnumerable<Cicm.Database.Models.ProcessorsByMachine>
|
||||
@using cicm_web.Areas.Admin.Models
|
||||
@model IEnumerable<cicm_web.Areas.Admin.Models.ProcessorsByMachineViewModel>
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Processors by machine (Admin)";
|
||||
@@ -60,14 +60,14 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach(ProcessorsByMachine item in Model)
|
||||
@foreach(ProcessorsByMachineViewModel item in Model)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Machine.Name)
|
||||
@Html.DisplayFor(modelItem => item.Machine)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Processor.Name)
|
||||
@Html.DisplayFor(modelItem => item.Processor)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Speed)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.2</TargetFramework>
|
||||
<Version>3.0.99.539</Version>
|
||||
<Version>3.0.99.540</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