public async Task <IActionResult> Create() { ViewData["CategoryId"] = new SelectList(await _categoriesService.GetCategoriesAsync(), "CategoryId", "CategoryName"); ViewData["SupplierId"] = new SelectList(await _suppliersService.GetSuppliersAsync(), "SupplierId", "CompanyName"); return(View()); }
public async Task <IActionResult> Create() { var categories = await _categoriesService.GetCategoriesAsync <CategoryList>(); var suppliers = await _suppliersService.GetSuppliersAsync <Supplier>(); ViewData["CategoryId"] = new SelectList(categories, "CategoryId", "CategoryName"); ViewData["SupplierId"] = new SelectList(suppliers, "SupplierId", "CompanyName"); return(View()); }
private async Task FillViewBagAsync() { var categories = await _categoriesService.GetCategoriesAsync(); var suppliers = await _suppliersService.GetSuppliersAsync(); ViewBag.Categories = categories; ViewBag.Suppliers = suppliers; }