public async Task <IActionResult> EditBars(int id) { try { var vm = new EditBarsViewModel(); var cocktail = await cocktailServices.GetDTOAsync(id); vm.Id = cocktail.Id; vm.CocktailName = cocktail.Name; vm.ImageUrl = cocktail.ImagePath; vm.AllOtherBars = (await cocktailServices.GetAllNotIncludedBarsDTOAsync(id)).Select(b => new SelectListItem(b.Name, b.Id.ToString())).ToList(); vm.BarsOfCocktail = (await cocktailServices.GetBarsOfCocktailAsync(id)).Select(b => new SelectListItem(b.Name, b.Id.ToString())).ToList(); return(View(vm)); } catch (InvalidOperationException) { return(BadRequest()); } }