Exemplo n.º 1
0
        public ActionResult BookAppointment(PatientsBookAppointmentViewModel model, string returnUrl)
        {
            if (Session["userId"] == null)
            {
                return(Redirect("~"));
            }
            Appointment appointment = model.ToAppointment(model);

            if ((int)Session["roleID"] == (int)Roles.Patient)
            {
                appointment.PatientId           = Convert.ToInt32(Session["userId"]);
                appointment.AppointmentStatusId = (byte)ClinicManagementSystemDOL.Enums.AppointmentStatus.Pending;
                appointment.CreatedAt           = DateTime.Now;
            }
            try
            {
                new Appointments().AddAppointment(appointment);
                return(RedirectToAction("AppointmentList", "Patient"));
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("", ex.Message);
                return(View(model));
            }
        }
Exemplo n.º 2
0
        public ActionResult BookAppointment(int id, DateTime date)
        {
            if (Session["userId"] == null)
            {
                return(Redirect("~"));
            }
            var bookAppointmentDetails = new PatientsBookAppointmentViewModel();

            bookAppointmentDetails.DoctorId        = id;
            bookAppointmentDetails.Date            = date;
            bookAppointmentDetails.PatientId       = (int)Session["userId"];
            TempData["DoctorId"]                   = id;
            TempData["SelectedDateForAppointment"] = date;
            return(View(bookAppointmentDetails));
        }