public IActionResult Edit(int id, PerfilViewModel perfil) { if (id != perfil.Id) { return(NotFound()); } if (!ModelState.IsValid) { return(View(perfil)); } try { _perfilService.Atualizar(perfil); } catch (DbUpdateConcurrencyException) { if (!PerfilExists(perfil.Id).Result) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); }