public async Task <IActionResult> Edit(int id, IngredietesViewModel vm) { if (id != vm.Id) { return(NotFound()); } if (ModelState.IsValid) { try { var entity = new Ingredientes { Id = vm.Id, NombreIngrediente = vm.NombreIngrediente }; await _Repository.Update(entity); } catch (DbUpdateConcurrencyException) { var isExists = await IngredientesExixst(vm.Id); if (!isExists) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(vm)); }