public ActionResult ManageAppointment(bool onlineAvailability, int?medicalId, int?doctorChamberId)
        {
            int doctorId = GetDoctorData().Id;

            if (User.IsInRole("Doctor"))
            {
                if (medicalId != null)
                {
                    if (aDoctorManager.CheckManageAppointment(doctorId, medicalId))
                    {
                        string message = aDoctorManager.ExistAppointmentAvailability(onlineAvailability, doctorId, medicalId);
                        if (message == "Success")
                        {
                            ViewBag.Message = "Manage Appointment availability changed successfully";
                        }
                        else
                        {
                            ViewBag.ErrorMessage = message;
                        }
                    }
                    else
                    {
                        ManageAppointment manageAppointment = new ManageAppointment();
                        manageAppointment.UsedAppoint           = 0;
                        manageAppointment.TotalAvailableAppoint = 0;
                        manageAppointment.DoctorId          = doctorId;
                        manageAppointment.MedicalId         = Convert.ToInt32(medicalId);
                        manageAppointment.DoctorChamberId   = 0;
                        manageAppointment.OnlineAppointment = onlineAvailability;
                        string message = aDoctorManager.AppointmentAvailability(manageAppointment);
                        if (message == "Success")
                        {
                            CreateOrderForChamber(manageAppointment);
                            ViewBag.Message = "Manage Appointment availability changed successfully";
                        }
                        else
                        {
                            ViewBag.ErrorMessage = message;
                        }
                    }
                }
                if (doctorChamberId != null)
                {
                    if (aDoctorManager.CheckChamberManageAppointment(doctorId, doctorChamberId))
                    {
                        string message = aDoctorManager.ExistChamberAppointmentAvailability(onlineAvailability, doctorId, doctorChamberId);
                        if (message == "Success")
                        {
                            ViewBag.Message = "Manage Appointment availability changed successfully";
                        }
                        else
                        {
                            ViewBag.ErrorMessage = message;
                        }
                    }
                    else
                    {
                        ManageAppointment manageAppointment = new ManageAppointment();
                        manageAppointment.UsedAppoint           = 0;
                        manageAppointment.TotalAvailableAppoint = 0;
                        manageAppointment.DoctorId          = doctorId;
                        manageAppointment.MedicalId         = 0;
                        manageAppointment.DoctorChamberId   = (int)doctorChamberId;
                        manageAppointment.OnlineAppointment = onlineAvailability;
                        string message = aDoctorManager.ChamberAppointmentAvailability(manageAppointment);
                        if (message == "Success")
                        {
                            CreateOrderForChamber(manageAppointment);
                            ViewBag.Message = "Manage Appointment availability changed successfully";
                        }
                        else
                        {
                            ViewBag.ErrorMessage = message;
                        }
                    }
                }
            }
            List <ViewDoctors>   doctorsChambers  = aDoctorManager.GetDoctorChambers(doctorId);
            List <DoctorChamber> doctorOwnChamber = aDoctorManager.GetDoctorOwnChamber(doctorId);
            List <OrderStatus>   orderDetails     = aDoctorManager.GetOrderStatus(doctorId);

            ViewBag.DoctorChambers    = doctorsChambers;
            ViewBag.DoctorOwnChambers = doctorOwnChamber;
            ViewBag.OrderStatus       = orderDetails;
            ViewBag.GetName           = GetDoctorData().Name;
            return(View());
        }