public async Task <IActionResult> Create([Bind("PatientID,RUT,FirstName,LastName,BloodType,HealthSystem,Created,Updated")] Patient patient) { if (ModelState.IsValid) { _context.Add(patient); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(patient)); }
public async Task <IActionResult> Create([Bind("DoctorID,RUT,FirstName,LastName,Specialty,Created,Updated")] Doctor doctor) { if (ModelState.IsValid) { _context.Add(doctor); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(doctor)); }
public async Task <IActionResult> Create([Bind("AppointmentID,PatientID,DoctorID,Date,Created,Updated")] Appointment appointment) { if (ModelState.IsValid) { _context.Add(appointment); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["DoctorID"] = new SelectList(_context.Doctors, "DoctorID", "DoctorID", appointment.DoctorID); ViewData["PatientID"] = new SelectList(_context.Patients, "PatientID", "PatientID", appointment.PatientID); return(View(appointment)); }