public ActionResult EditReceptionistSchedule(int id) { var collection = new ReceptionistScheduleCollection { ReceptionistSchedule = db.ReceptionistSchedules.Single(c => c.Id == id), Receptionists = db.Receptionists.ToList() }; return(View(collection)); }
public ActionResult AddReceptionistSchedule() { var collection = new ReceptionistScheduleCollection { ReceptionistSchedule = new ReceptionistSchedule(), Receptionists = db.Receptionists.ToList() }; return(View(collection)); }
public ActionResult AddReceptionistSchedule(ReceptionistScheduleCollection model) { if (!ModelState.IsValid) { var collection = new ReceptionistScheduleCollection { ReceptionistSchedule = model.ReceptionistSchedule, Receptionists = db.Receptionists.ToList() }; return(View(collection)); } db.ReceptionistSchedules.Add(model.ReceptionistSchedule); db.SaveChanges(); return(RedirectToAction("ListOfReceptionistSchedules")); }
public ActionResult EditReceptionistSchedule(int id, ReceptionistScheduleCollection model) { if (!ModelState.IsValid) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var ReceptionistSchedule = db.ReceptionistSchedules.Single(c => c.Id == id); ReceptionistSchedule.ReceptionistId = model.ReceptionistSchedule.ReceptionistId; ReceptionistSchedule.AvailableEndDay = model.ReceptionistSchedule.AvailableEndDay; ReceptionistSchedule.AvailableEndTime = model.ReceptionistSchedule.AvailableEndTime; ReceptionistSchedule.AvailableStartDay = model.ReceptionistSchedule.AvailableStartDay; ReceptionistSchedule.AvailableStartTime = model.ReceptionistSchedule.AvailableStartTime; ReceptionistSchedule.Status = model.ReceptionistSchedule.Status; db.SaveChanges(); return(RedirectToAction("ListOfReceptionistSchedules")); }