public async Task <IActionResult> Edit(CreateBarVM createBarVM) { if (ModelState.IsValid) { try { var barDTO = createBarVM.MapBarVMToDTO(); var barName = await _barServices.Update(barDTO); _toast.AddSuccessToastMessage($"You successfully edited \"{barName}\" bar!"); return(RedirectToAction(nameof(ListBars))); } catch (Exception ex) { _toast.AddErrorToastMessage(ex.Message); ViewBag.ErrorTitle = ""; return(View("Error")); } } var allCountries = await _barServices.GetAllCountries(); var allCocktails = await _cocktailServices.GetAllCocktails(); createBarVM.AllCocktails = allCocktails .Select(c => new SelectListItem(c.Name, c.Id)).ToList(); createBarVM.AllCountries = allCountries .Select(c => new SelectListItem(c.Name, c.Id)).ToList(); return(View(createBarVM)); }