public ActionResult GetDoctors(int id) { var doctors = facilityRepo.GetDoctors(id).Select(f => new { f.Id, f.Name }).ToList(); return(Json(doctors, JsonRequestBehavior.AllowGet)); }
// GET: Schedule/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } DoctorSchedule doctorSchedule = repo.GetById(id.Value); if (doctorSchedule == null) { return(HttpNotFound()); } var doctorFacilities = doctorFacilityRepo.GetAll(); ViewBag.DoctorId = new SelectList(facilityRepo.GetDoctors(doctorSchedule.FacilityId), "Id", "Name", doctorSchedule.DoctorId); ViewBag.FacilityId = new SelectList(doctorFacilityRepo.GetAllFacilities(), "Id", "Name", doctorSchedule.FacilityId); ViewBag.ForeignDoctorServiceId = doctorServiceRepo.GetAll(); return(View(doctorSchedule)); }