public IActionResult Atualizar(PetViewModel petViewModel, int id) { if (!ModelState.IsValid) { return(Retorno(ModelState)); } return(Retorno(_petService.Atualizar(petViewModel, id))); }
public IActionResult Editar(int id, PetViewModel model) { if (id != model.Id) { return(NotFound()); } if (ModelState.IsValid) { string nomeUnicoArquivo = UploadedFile(model); try { _petService.Atualizar(model); } catch (DbUpdateConcurrencyException) { throw; } return(RedirectToAction(nameof(Index))); } return(View(model)); }