public async Task <IActionResult> Edit(Guid?id, [Bind("Id,Cpf,PrimeiroNome,Sobrenome,Nascimento")] ManobristaViewModel model) { if (id != model.Id) { return(NotFound()); } if (ModelState.IsValid) { try { Manobrista ent = (await _domain.GetByIdAsync(id.Value)); if (ent == null) { return(NotFound()); } ent = ent.Map(model); _domain.Update(ent); await _work.SaveChangesAsync(); } catch (Exception) { if (!ManobristaViewModelExists(model.Id)) { return(NotFound()); } throw; } return(RedirectToAction(nameof(Index))); } return(View(model)); }
/// <summary> /// Iniciar a edição de um manobrista existente /// </summary> /// <param name="id">Id do registro</param> public async Task <IActionResult> Edit(Guid?id) { if (id == null) { return(NotFound()); } Manobrista ent = (await _domain.GetByIdAsync(id.Value)); if (ent == null) { return(NotFound()); } return(View(ent.Map())); }