public async Task <IActionResult> Edit(int id, [Bind("Id,ProfesionalId,PacienteId")] TablaProfesional_Paciente tablaProfesional_Paciente) { if (id != tablaProfesional_Paciente.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(tablaProfesional_Paciente); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TablaProfesional_PacienteExists(tablaProfesional_Paciente.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(tablaProfesional_Paciente)); }
public async Task <IActionResult> Create([Bind("Id,ProfesionalId,PacienteId")] TablaProfesional_Paciente tablaProfesional_Paciente) { if (ModelState.IsValid) { _context.Add(tablaProfesional_Paciente); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(tablaProfesional_Paciente)); }
public async Task <IActionResult> Create([Bind("Id,Nombre,Apellido1,Apellido2,Fecha_de_nacimiento,Seguro_privado,DNI,Direccion_postal,telefono_fijo,telefono_movil_1,telefono_movil_2,Sexo")] TablaPaciente tablaPaciente, int?IdProfesional) { if (ModelState.IsValid) { _context.Add(tablaPaciente); if (IdProfesional != null) { TablaProfesional_Paciente t = new TablaProfesional_Paciente(); t.ProfesionalId = IdProfesional.Value; t.Paciente = tablaPaciente; _context.Add(t); } await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(tablaPaciente)); }