public async Task <IActionResult> EditQuanities(int id, EditCocktailViewModel cocktailToEdit) { if (ModelState.IsValid) { try { var ingredientsQuantityDTO = cocktailToEdit.IngredientsQuantity.Select(i => i.MapToDTO()).ToList(); await cocktailServices.EditIngredientsAsync(id, ingredientsQuantityDTO, cocktailToEdit.IngredientsToRemove); return(RedirectToAction("Details", new { id = cocktailToEdit.Id })); } catch (InvalidOperationException) { return(BadRequest()); } } ModelState.AddModelError("", "Something went wrong..."); return(View(cocktailToEdit)); }