diff --git a/cicm_web/Areas/Admin/Controllers/CompanyDescriptionsController.cs b/cicm_web/Areas/Admin/Controllers/CompanyDescriptionsController.cs index 798521c5..8397c853 100644 --- a/cicm_web/Areas/Admin/Controllers/CompanyDescriptionsController.cs +++ b/cicm_web/Areas/Admin/Controllers/CompanyDescriptionsController.cs @@ -58,7 +58,7 @@ namespace cicm_web.Areas.Admin.Controllers { IIncludableQueryable cicmContext = _context.CompanyDescriptions.Include(c => c.Company); - return View(await cicmContext.ToListAsync()); + return View(await cicmContext.OrderBy(c => c.Company.Name).ToListAsync()); } // GET: CompanyDescription/Details/5 @@ -77,7 +77,7 @@ namespace cicm_web.Areas.Admin.Controllers // GET: CompanyDescription/Create public IActionResult Create() { - ViewData["CompanyId"] = new SelectList(_context.Companies, "Id", "Name"); + ViewData["CompanyId"] = new SelectList(_context.Companies.OrderBy(c => c.Name), "Id", "Name"); return View(); } @@ -96,7 +96,8 @@ namespace cicm_web.Areas.Admin.Controllers return RedirectToAction(nameof(Index)); } - ViewData["CompanyId"] = new SelectList(_context.Companies, "Id", "Name", companyDescription.CompanyId); + ViewData["CompanyId"] = new SelectList(_context.Companies.OrderBy(c => c.Name), "Id", "Name", + companyDescription.CompanyId); return View(companyDescription); } @@ -108,7 +109,8 @@ namespace cicm_web.Areas.Admin.Controllers CompanyDescription companyDescription = await _context.CompanyDescriptions.FindAsync(id); if(companyDescription == null) return NotFound(); - ViewData["CompanyId"] = new SelectList(_context.Companies, "Id", "Name", companyDescription.CompanyId); + ViewData["CompanyId"] = new SelectList(_context.Companies.OrderBy(c => c.Name), "Id", "Name", + companyDescription.CompanyId); return View(companyDescription); } @@ -139,7 +141,8 @@ namespace cicm_web.Areas.Admin.Controllers return RedirectToAction(nameof(Index)); } - ViewData["CompanyId"] = new SelectList(_context.Companies, "Id", "Name", companyDescription.CompanyId); + ViewData["CompanyId"] = new SelectList(_context.Companies.OrderBy(c => c.Name), "Id", "Name", + companyDescription.CompanyId); return View(companyDescription); } diff --git a/cicm_web/cicm_web.csproj b/cicm_web/cicm_web.csproj index 3d224064..52a55ccc 100644 --- a/cicm_web/cicm_web.csproj +++ b/cicm_web/cicm_web.csproj @@ -2,7 +2,7 @@ netcoreapp2.2 - 3.0.99.513 + 3.0.99.515 Canary Islands Computer Museum Copyright © 2003-2018 Natalia Portillo Canary Islands Computer Museum Website