public ActionResult Create(Specialty specialty, int DoctorId) { _db.Specialties.Add(specialty); if (DoctorId != 0) { _db.DoctorSpecialty.Add(new DoctorSpecialty() { DoctorId = DoctorId, SpecialtyId = specialty.SpecialtyId }); } _db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Create(Patient patient, int DoctorId) { _db.Patients.Add(patient); if (DoctorId != 0) { _db.DoctorPatient.Add(new DoctorPatient() { DoctorId = DoctorId, PatientId = patient.PatientId }); } _db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Create(Doctor doctor, int SpecialtyId) { _db.Doctors.Add(doctor); if (SpecialtyId != 0) { _db.DoctorSpecialty.Add(new DoctorSpecialty() { SpecialtyId = SpecialtyId, DoctorId = doctor.DoctorId }); } _db.SaveChanges(); return(RedirectToAction("Index")); }
public async Task <ActionResult> Create(Doctor doctor) { try { var userId = this.User.FindFirst(ClaimTypes.NameIdentifier)?.Value; var currentUser = await _userManager.FindByIdAsync(userId); doctor.User = currentUser; _db.Doctors.Add(doctor); _db.SaveChanges(); } catch (Exception ex) { Console.WriteLine("Exception Error in Create(): " + ex); } return(RedirectToAction("Index")); }
public ActionResult Create(Patient patient, int[] doctorId) { _db.Patients.Add(patient); foreach (var id in doctorId) { if (id != 0) { _db.DoctorPatient.Add(new DoctorPatient() { DoctorId = id, PatientId = patient.PatientId }); } } _db.SaveChanges(); return(RedirectToAction("Index")); }
public async Task <ActionResult> Create(Patient patient, int DoctorId) { try { var userId = this.User.FindFirst(ClaimTypes.NameIdentifier)?.Value; var currentUser = await _userManager.FindByIdAsync(userId); patient.User = currentUser; _db.Patients.Add(patient); if (DoctorId != 0) { _db.DoctorPatients.Add(new DoctorPatient() { DoctorId = DoctorId, PatientId = patient.PatientId }); } _db.SaveChanges(); } catch (Exception ex) { Console.WriteLine("Exception Error in Create(): " + ex); } return(RedirectToAction("Index")); }
public ActionResult Create(Specialty specialty) { _db.Specialties.Add(specialty); _db.SaveChanges(); return(RedirectToAction("Details", new { id = specialty.SpecialtyId })); }
public ActionResult Create(Doctor doctor) { _db.Doctors.Add(doctor); _db.SaveChanges(); return RedirectToAction("Index"); }
public ActionResult Create(Patient patient) { _db.Patient.Add(patient); _db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Create(Specialty specialty) { _db.Specialties.Add(specialty); _db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Create(Patient patient) { _db.Patients.Add(patient); _db.SaveChanges(); return(RedirectToAction("Details", new { id = patient.PatientId })); }
public ActionResult Create(Doctor doctor) { _db.Doctors.Add(doctor); _db.SaveChanges(); return(RedirectToAction("Details", new { id = doctor.DoctorId })); }