[ValidateAntiForgeryToken] //Prevenimos cambios externos public async Task <IActionResult> Create([Bind("PubIntIdDoctor,PubStrNombre,PubStrCredencial,PubStrHospital,PubStrTelefono,PubStrEmail")] Doctor doctor, int PubIntIdEspecialidad) { if (ModelState.IsValid) { _context.Add(doctor); await _context.SaveChangesAsync(); var doctorEspecialidad = new DoctorEspecialidad(); doctorEspecialidad.PubIntIdDoctor = doctor.PubIntIdDoctor; doctorEspecialidad.PubIntIdEspecialidad = PubIntIdEspecialidad; _context.Add(doctorEspecialidad); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(doctor)); }
[ValidateAntiForgeryToken] //Prevenimos cambios externos public async Task <IActionResult> Create([Bind("PubIntIdPaciente,PubStrNombre,PubStrSeguro,PubStrCodigoPostal,PubStrTelefono,PubStrDireccion,PubStrEmail")] Paciente paciente) { if (ModelState.IsValid) { _context.Add(paciente); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(paciente)); }
public async Task <IActionResult> Create([Bind("PubIntIdEspecialidad,PubStrDescripcion")] Especialidad especialidad) { if (ModelState.IsValid) { _context.Add(especialidad); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(especialidad)); }