public ActionResult DeleteConfirmed(int id) { VisitingSession visitingsession = db.VisitingSessions.Find(id); db.VisitingSessions.Remove(visitingsession); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "VisitingSessionId,StartTime,EndTime,ChamberId,DoctorId,MaxNoOfAppointments")] VisitingSession visitingsession) { if (ModelState.IsValid) { db.Entry(visitingsession).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ChamberId = new SelectList(db.Chambers, "ChamberId", "Name", visitingsession.ChamberId); ViewBag.DoctorId = new SelectList(db.Doctors, "DoctorId", "Name", visitingsession.DoctorId); return(View(visitingsession)); }
public ActionResult Create([Bind(Include = "VisitingSessionId,StartTime,EndTime,ChamberId,DoctorId,MaxNoOfAppointments")] VisitingSession visitingsession) { if (ModelState.IsValid) { db.VisitingSessions.Include(v => v.Doctor).Include(v => v.Chamber); db.VisitingSessions.Add(visitingsession); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ChamberId = new SelectList(db.Chambers, "ChamberId", "Name", visitingsession.ChamberId); ViewBag.DoctorId = new SelectList(db.Doctors, "DoctorId", "Name", visitingsession.DoctorId); return(View(visitingsession)); }
// GET: /VisitingSession/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } VisitingSession visitingsession = db.VisitingSessions.Find(id); if (visitingsession == null) { return(HttpNotFound()); } return(View(visitingsession)); }
// GET: /VisitingSession/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } VisitingSession visitingsession = db.VisitingSessions.Find(id); if (visitingsession == null) { return(HttpNotFound()); } ViewBag.ChamberId = new SelectList(db.Chambers, "ChamberId", "Name", visitingsession.ChamberId); ViewBag.DoctorId = new SelectList(db.Doctors, "DoctorId", "Name", visitingsession.DoctorId); return(View(visitingsession)); }
public ActionResult Create(int?DoctorId, int?ChamberId, int?VisitingSessionId) { aDoctor = db.Doctors.Find(DoctorId); aChamber = db.Chambers.Find(ChamberId); aVisitingSession = db.VisitingSessions.Find(VisitingSessionId); ViewBag.SelectedDoctor = aDoctor; ViewBag.SelectedChamber = aChamber; ViewBag.SelectedVisitingSession = aVisitingSession; TimeSpan timeDiff = aVisitingSession.EndTime - aVisitingSession.StartTime; int servingTime = (int)timeDiff.TotalMinutes; int totalNoOfAppointments = db.Appointments.Count(a => a.VisitingSessionId == aVisitingSession.VisitingSessionId); int timeSlotPerPatient = servingTime / aVisitingSession.MaxNoOfAppointments; ViewBag.AppointmentTime = aVisitingSession.StartTime.AddMinutes(totalNoOfAppointments * timeSlotPerPatient); ViewBag.SerialNo = "SN" + totalNoOfAppointments.ToString("000"); return(View()); }