Example #1
0
        public virtual IActionResult CancelAppointment(AppointmentDatesModel model)
        {
            //permissions
            if (SharedData.isAppointmentMenuAccessible == false)
            {
                return(AccessDeniedView());
            }
            ResponceModel responceModel = new ResponceModel();

            try
            {
                //Get AppointmentDate By Ussing AppointmentId and AppointmentDate
                var appointmentDateData = _appointmentServices.GetAppointmentDateByAppointmentIdAndAppointmentDateId(AppointmentDateId: model.Id, AppointmentId: model.AppointmentMasterId);
                if (appointmentDateData != null)
                {
                    appointmentDateData.AppointmentStatusId = (int)AppointmentStatus.Cancelled;
                    _appointmentServices.UpdateAppointmentDate(appointmentDateData);
                    responceModel.Success = true;
                    responceModel.Message = "Deleted.";
                    return(Json(responceModel));
                }
                else
                {
                    responceModel.Success = false;
                    responceModel.Message = "NotDelete";
                    return(Json(responceModel));
                }
            }
            catch (Exception e) { }
            responceModel.Success = false;
            responceModel.Message = "NotDelete";
            return(Json(responceModel));
        }
        public IActionResult CancelAppointment(AppointmentDatesModel model)
        {
            //permissions
            //if (SharedData.isAppointmentMenuAccessible == false)
            //    return AccessDeniedView();
            ResultModel resultModel = new ResultModel();

            try
            {
                //Get AppointmentDate By Ussing AppointmentId and AppointmentDate
                var appointmentDateData = _appointmentServices.GetAppointmentDateByAppointmentIdAndAppointmentDateId(AppointmentDateId: model.ID, AppointmentId: model.AppointmentMasterId);
                if (appointmentDateData != null)
                {
                    appointmentDateData.AppointmentStatusId = (int)AppointmentStatus.Cancelled;
                    _appointmentServices.UpdateAppointmentDate(appointmentDateData);
                    resultModel.Status   = 1;
                    resultModel.Message  = ValidationMessages.Success;
                    resultModel.Response = "Appointmnet Cancelled ";
                    return(Ok(resultModel));
                }
                else
                {
                    resultModel.Message  = ValidationMessages.Failure;
                    resultModel.Status   = 0;
                    resultModel.Response = "Appointment NotCancelled";
                    return(Ok(resultModel));
                }
            }
            catch (Exception e)
            {
                resultModel.Message  = ValidationMessages.Failure;
                resultModel.Status   = 0;
                resultModel.Response = null;
                return(Ok(resultModel));
            }
        }