public ActionResult EditNurseSchedule(int id) { var collection = new NurseScheduleCollection { NurseSchedule = db.NurseSchedules.Single(c => c.Id == id), Nurses = db.Nurses.ToList() }; return(View(collection)); }
public ActionResult AddNurseSchedule() { var collection = new NurseScheduleCollection { NurseSchedule = new NurseSchedule(), Nurses = db.Nurses.ToList() }; return(View(collection)); }
public ActionResult AddNurseSchedule(NurseScheduleCollection model) { if (!ModelState.IsValid) { var collection = new NurseScheduleCollection { NurseSchedule = model.NurseSchedule, Nurses = db.Nurses.ToList() }; return(View(collection)); } db.NurseSchedules.Add(model.NurseSchedule); db.SaveChanges(); return(RedirectToAction("ListOfNurseSchedules")); }
public ActionResult EditNurseSchedule(int id, NurseScheduleCollection model) { if (!ModelState.IsValid) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var NurseSchedule = db.NurseSchedules.Single(c => c.Id == id); NurseSchedule.NurseId = model.NurseSchedule.NurseId; NurseSchedule.AvailableEndDay = model.NurseSchedule.AvailableEndDay; NurseSchedule.AvailableEndTime = model.NurseSchedule.AvailableEndTime; NurseSchedule.AvailableStartDay = model.NurseSchedule.AvailableStartDay; NurseSchedule.AvailableStartTime = model.NurseSchedule.AvailableStartTime; NurseSchedule.Status = model.NurseSchedule.Status; db.SaveChanges(); return(RedirectToAction("ListOfNurseSchedules")); }