// GET: Doctors public ActionResult Index(string searchString = "") { IBL bl = new BLImplement(); List <DoctorViewModel> lst = new List <DoctorViewModel>(); foreach (var item in bl.getAllDoctors()) { lst.Add(new DoctorViewModel(item)); } if (!String.IsNullOrEmpty(searchString)) { lst = lst.Where(s => s.Name.ToLower().Contains(searchString.ToLower()) || s.SpecialName.ToLower().Contains(searchString.ToLower())).ToList(); } return(View(lst)); }
public ActionResult DeleteConfirmed(string id) { try { IBL bl = new BLImplement(); Doctor doctor = bl.getDoctor(id); bl.deleteDoctor(doctor); ViewBag.Message = String.Format("The doctor {0} is successfully deledted", doctor.Name); return(RedirectToAction("Index")); } catch (Exception ex) { ViewBag.Message = String.Format(ex.Message); return(RedirectToAction("Delete")); } }
// GET: Doctors/Details/5 public ActionResult Details(string id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } IBL bl = new BLImplement(); Doctor doctor = bl.getDoctor(id); if (doctor == null) { return(HttpNotFound()); } DoctorViewModel dvm = new DoctorViewModel(doctor); return(View(dvm)); }