Optimize view of processors admin page.

This commit is contained in:
2019-05-20 00:13:24 +01:00
parent 1760e98da2
commit 3b057339a5
4 changed files with 71 additions and 6 deletions

View File

@@ -55,7 +55,16 @@ namespace cicm_web.Areas.Admin.Controllers
{
IIncludableQueryable<Processor, InstructionSet> cicmContext =
_context.Processors.Include(p => p.Company).Include(p => p.InstructionSet);
return View(await cicmContext.OrderBy(p => p.Company.Name).ThenBy(p => p.Name).ToListAsync());
return View(await cicmContext.OrderBy(p => p.Company.Name).ThenBy(p => p.Name)
.Select(p => new ProcessorViewModel
{
Company = p.Company.Name,
Id = p.Id,
InstructionSet = p.InstructionSet.Name,
Introduced = p.Introduced,
ModelCode = p.ModelCode,
Name = p.Name
}).ToListAsync());
}
// GET: Admin/Processors/Details/5