public ActionResult Create(string doctorName, int specialtyId) { Doctor newDoctor = new Doctor(doctorName); newDoctor.Save(); newDoctor.AddToJoinTable(specialtyId); return(RedirectToAction("Index")); }
public ActionResult CreateDoctorInSpecialty(string doctorName, int specialtyId) { Doctor newDoctor = new Doctor(doctorName); newDoctor.Save(); newDoctor.AddToJoinTable(specialtyId); Dictionary <string, object> model = new Dictionary <string, object>(); Specialty selectedSpecialty = Specialty.Find(specialtyId); List <Doctor> specialtyDoctors = Specialty.GetDoctors(specialtyId); model.Add("specialty", selectedSpecialty); model.Add("specialtyDoctors", specialtyDoctors); return(View("Show", model)); }