public async Task <IActionResult> Edit(int id, [Bind("Id,Nome,Email")] Dentista dentista) { if (id != dentista.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(dentista); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DentistaExists(dentista.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(dentista)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Numero,Codigo")] Sala sala) { if (id != sala.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(sala); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SalaExists(sala.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(sala)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,DentistaId,SalaId,DataDisponivel,PacienteId")] Agenda agenda) { if (id != agenda.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(agenda); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AgendaExists(agenda.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(agenda)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Nome,Email")] Paciente paciente, [Bind("Id, Logradouro, Numero, Bairro, Cidade, Estado, CEP")] Endereco endereco, [Bind("Id, Tipo, Telefone")] List <Contato> contato) { if (id != paciente.Id) { return(NotFound()); } if (ModelState.IsValid) { try { paciente.Endereco = endereco; paciente.Contato = contato; paciente.Endereco.PacienteId = paciente.Id; foreach (var c in paciente.Contato) { c.PacienteId = paciente.Id; } _context.Update(paciente); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PacienteExists(paciente.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(paciente)); }