Sort dropdowns in companies admin pages.

This commit is contained in:
2019-05-19 20:27:05 +01:00
parent aae40cea72
commit 4e3558e045
2 changed files with 9 additions and 9 deletions

View File

@@ -73,8 +73,8 @@ namespace cicm_web.Areas.Admin.Controllers
// GET: Admin/Companies/Create
public IActionResult Create()
{
ViewData["CountryId"] = new SelectList(_context.Iso31661Numeric, "Id", "Name");
ViewData["SoldToId"] = new SelectList(_context.Companies, "Id", "Name");
ViewData["CountryId"] = new SelectList(_context.Iso31661Numeric.OrderBy(c => c.Name), "Id", "Name");
ViewData["SoldToId"] = new SelectList(_context.Companies.OrderBy(c => c.Name), "Id", "Name");
return View();
}
@@ -95,8 +95,8 @@ namespace cicm_web.Areas.Admin.Controllers
return RedirectToAction(nameof(Index));
}
ViewData["CountryId"] = new SelectList(_context.Iso31661Numeric, "Id", "Name", company.CountryId);
ViewData["SoldToId"] = new SelectList(_context.Companies, "Id", "Name", company.SoldToId);
ViewData["CountryId"] = new SelectList(_context.Iso31661Numeric.OrderBy(c => c.Name), "Id", "Name", company.CountryId);
ViewData["SoldToId"] = new SelectList(_context.Companies.OrderBy(c => c.Name), "Id", "Name", company.SoldToId);
return View(company);
}
@@ -108,8 +108,8 @@ namespace cicm_web.Areas.Admin.Controllers
Company company = await _context.Companies.FindAsync(id);
if(company == null) return NotFound();
ViewData["CountryId"] = new SelectList(_context.Iso31661Numeric, "Id", "Name", company.CountryId);
ViewData["SoldToId"] = new SelectList(_context.Companies, "Id", "Name", company.SoldToId);
ViewData["CountryId"] = new SelectList(_context.Iso31661Numeric.OrderBy(c => c.Name), "Id", "Name", company.CountryId);
ViewData["SoldToId"] = new SelectList(_context.Companies.OrderBy(c => c.Name), "Id", "Name", company.SoldToId);
return View(company);
}
@@ -142,8 +142,8 @@ namespace cicm_web.Areas.Admin.Controllers
return RedirectToAction(nameof(Index));
}
ViewData["CountryId"] = new SelectList(_context.Iso31661Numeric, "Id", "Name", company.CountryId);
ViewData["SoldToId"] = new SelectList(_context.Companies, "Id", "Name", company.SoldToId);
ViewData["CountryId"] = new SelectList(_context.Iso31661Numeric.OrderBy(c => c.Name), "Id", "Name", company.CountryId);
ViewData["SoldToId"] = new SelectList(_context.Companies.OrderBy(c => c.Name), "Id", "Name", company.SoldToId);
return View(company);
}