public ActionResult Delete(DoctorAndNetUsers model)
        {
            ViewBag.Message = "Appointment Cancelled !";
            AllAppointment deleteAppointment = myEntities.AllAppointments.FirstOrDefault(a => a.AptId == model.AllAppointment.AptId);

            myEntities.AllAppointments.Remove(deleteAppointment);
            myEntities.SaveChanges();
            return(View("ConfirmAppointment"));
        }
        public ActionResult ConfirmAppointment(DoctorAndNetUsers model)
        {
            string   UserName    = User.Identity.Name;
            int      DoctorId    = model.Doctor.DocId;
            DateTime AptDate     = Convert.ToDateTime(model.AllAppointment.SlotDate);
            string   AptTime     = model.AllAppointment.Slots;
            var      existsOrNot = myEntities.AllAppointments.Where(c => c.DoctorId == DoctorId && c.SlotDate == AptDate && c.Slots == AptTime);
            var      count       = existsOrNot.Count();

            if (count == 0)
            {
                if (AptTime == null)
                {
                    ViewBag.Slots = new SelectList(myEntities.doctorSlots.Where(d => d.doctorId == DoctorId), "slotTimes", "slotTimes");
                    var doctor = myEntities.Doctors.Where(d => d.DocId == DoctorId).FirstOrDefault();
                    DoctorAndNetUsers doctorAndNetUser = new DoctorAndNetUsers();
                    doctorAndNetUser.Doctor                  = doctor;
                    doctorAndNetUser.AllAppointment          = new AllAppointment();
                    doctorAndNetUser.AllAppointment.SlotDate = Convert.ToDateTime(DateTime.Now);
                    doctorAndNetUser.AllAppointment.Slots    = "";
                    return(View("Schedule", doctorAndNetUser));
                }
                else
                {
                    AllAppointment appointment = new AllAppointment();
                    appointment.UserName       = UserName;
                    appointment.DoctorId       = DoctorId;
                    appointment.SlotDate       = AptDate;
                    appointment.Slots          = AptTime;
                    appointment.DrAvailability = "yes";
                    myEntities.AllAppointments.Add(appointment);
                    myEntities.SaveChanges();
                    ViewBag.Message = "Appointment Confirmed !";
                    return(View());
                }
            }
            else
            {
                ViewBag.Message = "Slots not Available Now !";
                return(View());
            }
        }
        public ActionResult Edit(DoctorAndNetUsers model)
        {
            string   UserName    = User.Identity.Name;
            int      DoctorId    = model.Doctor.DocId;
            DateTime AptDate     = Convert.ToDateTime(model.AllAppointment.SlotDate);
            string   AptTime     = model.AllAppointment.Slots;
            var      existsOrNot = myEntities.AllAppointments.Where(c => c.DoctorId == DoctorId && c.SlotDate == AptDate && c.Slots == AptTime);
            var      count       = existsOrNot.Count();

            if (count == 0)
            {
                AllAppointment appointment = myEntities.AllAppointments.FirstOrDefault(a => a.AptId == model.AllAppointment.AptId);
                appointment.SlotDate = AptDate;
                appointment.Slots    = AptTime;
                myEntities.SaveChanges();
                ViewBag.Message = "Appointment Confirmed !";
            }
            else
            {
                ViewBag.Message = "Slots not Available Now !";
            }
            return(View("ConfirmAppointment"));
        }