public ActionResult AddAppointment(int eventID) { Session["action"] = "viewlist"; Working_Schedule ws = db.Working_Schedule.SingleOrDefault(a => a.WorkingSchedule_ID == eventID); if (Session["date"] == null) { Session["date"] = ws.Start.Value.ToShortDateString(); } if (Session["dayofweek"] == null) { Session["dayofweek2"] = ws.Working_Day.WorkingDay_Period.ToString(); } if (ws == null) { Response.StatusCode = 404; return(null); } List <Appointment> listApp = getAppoimentList(); Appointment app = listApp.Find(a => a.Appointment_ID == eventID); if (app == null) { app = new Appointment(eventID); listApp.Add(app); } return(RedirectToAction("Appointment")); }
public ActionResult DeleteConfirmed(int id) { Working_Schedule working_Schedule = db.Working_Schedule.Find(id); db.Working_Schedule.Remove(working_Schedule); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult AddSchedule(string ms, string dt, int ddl, int ro, int dt_id) { Session["action"] = "viewlist"; string day, start, end; var ms_id = db.Medical_Specialty.SingleOrDefault(m => m.MedicalSpecialty_Name.Equals(ms)); var wt = db.Working_Time.SingleOrDefault(n => n.WorkingTime_ID == ddl); if (Session["dayofweek"] != null) { if (wt.WorkingTime_ID > 6) { day = String.Concat(Session["dayofweek"].ToString(), " Morning"); } else { day = String.Concat(Session["dayofweek"].ToString(), " Evening"); } } else { day = Session["dayofweek2"].ToString(); } start = String.Concat(Session["date"], " ", wt.WoringTime_Period.Substring(0, 5)); end = String.Concat(Session["date"], " ", wt.WoringTime_Period.Substring(8, 5)); var wd = db.Working_Day.SingleOrDefault(d => d.WorkingDay_Period.Equals(day)); Working_Schedule ws = new Working_Schedule { Doctor_ID = Convert.ToInt32(dt_id), WorkingTime_ID = Convert.ToInt32(ddl), WorkingRoom_ID = ro, WorkingDay_ID = wd.WorkingDay_ID, Start = Convert.ToDateTime(start), End = Convert.ToDateTime(end) }; db.Working_Schedule.Add(ws); db.SaveChanges(); List <Appointment> listApp = getAppoimentList(); Appointment app = listApp.Find(a => a.Medical_Specialty.Equals(ms)); if (app == null) { app = new Appointment(ws.WorkingSchedule_ID); listApp.Add(app); } return(RedirectToAction("Appointment")); }
public ActionResult Edit([Bind(Include = "WorkingSchedule_ID,Doctor_ID,WorkingTime_ID,WorkingDay_ID,WorkingRoom_ID,Description,Start,End,ThemeColor,IsFullDay")] Working_Schedule working_Schedule) { if (ModelState.IsValid) { db.Entry(working_Schedule).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Doctor_ID = new SelectList(db.Doctors, "Doctor_ID", "Doctor_Name", working_Schedule.Doctor_ID); ViewBag.WorkingDay_ID = new SelectList(db.Working_Day, "WorkingDay_ID", "WorkingDay_Period", working_Schedule.WorkingDay_ID); ViewBag.WorkingRoom_ID = new SelectList(db.Working_Room, "WorkingRoom_ID", "WorkingRoom_Number", working_Schedule.WorkingRoom_ID); ViewBag.WorkingTime_ID = new SelectList(db.Working_Time, "WorkingTime_ID", "WoringTime_Period", working_Schedule.WorkingTime_ID); return(View(working_Schedule)); }
// GET: Working_Schedule/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Working_Schedule working_Schedule = db.Working_Schedule.Find(id); if (working_Schedule == null) { return(HttpNotFound()); } return(View(working_Schedule)); }
// GET: Working_Schedule/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Working_Schedule working_Schedule = db.Working_Schedule.Find(id); if (working_Schedule == null) { return(HttpNotFound()); } ViewBag.Doctor_ID = new SelectList(db.Doctors, "Doctor_ID", "Doctor_Name", working_Schedule.Doctor_ID); ViewBag.WorkingDay_ID = new SelectList(db.Working_Day, "WorkingDay_ID", "WorkingDay_Period", working_Schedule.WorkingDay_ID); ViewBag.WorkingRoom_ID = new SelectList(db.Working_Room, "WorkingRoom_ID", "WorkingRoom_Number", working_Schedule.WorkingRoom_ID); ViewBag.WorkingTime_ID = new SelectList(db.Working_Time, "WorkingTime_ID", "WoringTime_Period", working_Schedule.WorkingTime_ID); return(View(working_Schedule)); }
public ActionResult DeleteAppointment(int appId) { Working_Schedule ws = db.Working_Schedule.SingleOrDefault(a => a.WorkingSchedule_ID == appId); if (ws == null) { Response.StatusCode = 404; return(null); } List <Appointment> listApp = getAppoimentList(); Appointment app = listApp.SingleOrDefault(i => i.Appointment_ID == appId); if (app != null) { listApp.RemoveAll(c => c.Appointment_ID == appId); } return(RedirectToAction("Appointment")); }