Optimize view of sound synthetizers admin page.

This commit is contained in:
2019-05-20 00:30:14 +01:00
parent 91e9b04b45
commit a51f93ea20
4 changed files with 70 additions and 5 deletions

View File

@@ -54,7 +54,16 @@ namespace cicm_web.Areas.Admin.Controllers
public async Task<IActionResult> Index()
{
IIncludableQueryable<SoundSynth, Company> cicmContext = _context.SoundSynths.Include(s => s.Company);
return View(await cicmContext.ToListAsync());
return View(await cicmContext.OrderBy(s => s.Company).ThenBy(s => s.Name).ThenBy(s => s.ModelCode)
.Select(s => new SoundSynthViewModel
{
Company = s.Company.Name,
Id = s.Id,
Introduced = s.Introduced,
ModelCode = s.ModelCode,
Name = s.Name,
Type = s.Type
}).ToListAsync());
}
// GET: Admin/SoundSynths/Details/5