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

View File

@@ -2,7 +2,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web"> <Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework> <TargetFramework>netcoreapp2.2</TargetFramework>
<Version>3.0.99.506</Version> <Version>3.0.99.507</Version>
<Company>Canary Islands Computer Museum</Company> <Company>Canary Islands Computer Museum</Company>
<Copyright>Copyright © 2003-2018 Natalia Portillo</Copyright> <Copyright>Copyright © 2003-2018 Natalia Portillo</Copyright>
<Product>Canary Islands Computer Museum Website</Product> <Product>Canary Islands Computer Museum Website</Product>