コード例 #1
0
        //delete the appointment from the db
        public ActionResult DeleteAppointment(int id)
        {
            var db = new appointmentEntities();
            var foundAppointment = db.appointments.Where(u => u.Id.Equals(id)).FirstOrDefault();

            db.appointments.Remove(foundAppointment);
            db.SaveChanges();

            return(RedirectToAction("OpenDoctorLanding", "Doctor"));
        }
コード例 #2
0
        //cancel an already set appt
        public ActionResult CancelAppointment()
        {
            var db = new appointmentEntities();
            var currentUserEmail = Session["EMAIL"] as string;

            var v = db.appointments.Where(u => u.user.Equals(currentUserEmail) && u.astate.Equals("booked")).FirstOrDefault();

            db.appointments.Remove(v);
            db.SaveChanges();
            return(RedirectToAction("OpenUserLanding", "User"));
        }