private async Task LoadData() { var category = await _appFoodCategory.ListAsync(); var categorySelectList = new SelectList(category, "Id", "Name"); ViewBag.CategorySelectList = categorySelectList; }
public async Task <IActionResult> Index() { if (TempData["Success"] as bool? ?? false) { ViewBag.Success = TempData["Success"]; ViewBag.Message = TempData["Message"]; } var model = await _appFoodCategory.ListAsync(); return(View(model)); }