Example #1
0
 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());
 }
Example #2
0
        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());
        }
Example #3
0
        private async Task FillViewBagAsync()
        {
            var categories = await _categoriesService.GetCategoriesAsync();

            var suppliers = await _suppliersService.GetSuppliersAsync();

            ViewBag.Categories = categories;
            ViewBag.Suppliers  = suppliers;
        }