public Response <AppointmentResourceViewModel> UpdateAppointmentResource(AppointmentResourceViewModel appointmentResourceDetail)
        {
            List <AppointmentResourceViewModel> appointmentResourceDetails = new List <AppointmentResourceViewModel>();

            appointmentResourceDetails.Add(appointmentResourceDetail);
            return(appointmentRepository.UpdateAppointmentResource(appointmentResourceDetails));
        }
예제 #2
0
        public JsonResult AddAppointmentResource(AppointmentResourceViewModel appointmentResourceDetail)
        {
            List <AppointmentResourceViewModel> appointmentResourceDetails = new List <AppointmentResourceViewModel>();

            appointmentResourceDetails.Add(appointmentResourceDetail);
            return(Json(appointmentRepository.AddAppointmentResource(appointmentResourceDetails)));
        }
        /// <summary>
        /// Update the appointment resource no show flag.
        /// </summary>
        /// <param name="appointmentResource"></param>
        /// <returns></returns>
        public Response <AppointmentResourceViewModel> UpdateAppointmentNoShow(AppointmentResourceViewModel appointmentResource)
        {
            const string apiUrl = baseRoute + "UpdateAppointmentNoShow";

            return
                (communicationManager.Put <AppointmentResourceModel, Response <AppointmentResourceModel> >(appointmentResource.ToModel(), apiUrl)
                 .ToViewModel());
        }
예제 #4
0
        public void AddAppointmentResource_Failed()
        {
            // Arrange
            var appointmentResources = new AppointmentResourceViewModel()
            {
                AppointmentID  = -1,
                ResourceTypeID = 2,
                ResourceID     = 5
            };

            // Act
            var result   = controller.AddAppointmentResource(appointmentResources);
            var response = result as Response <AppointmentResourceViewModel>;

            // Assert
            Assert.IsTrue(response != null, "Response can't be null");
            Assert.IsTrue(response.ResultCode != 0, "Add appointment resource expected to be failed.");
        }
예제 #5
0
        public void UpdateAppointmentResource_Success()
        {
            // Arrange
            var appointmentResources = new AppointmentResourceViewModel()
            {
                AppointmentResourceID = 1,
                AppointmentID         = 1,
                ResourceTypeID        = 2,
                ResourceID            = 5
            };

            // Act
            var result   = controller.UpdateAppointmentResource(appointmentResources);
            var response = result as Response <AppointmentResourceViewModel>;

            // Assert
            Assert.IsTrue(response != null, "Response can't be null");
            Assert.IsTrue(response.ResultCode == 0, "Appointment resource could not be updated.");
        }
        /// <summary>
        /// Converts viewmodel to model
        /// </summary>
        /// <param name="model">The model.</param>
        /// <returns></returns>
        public static AppointmentResourceModel ToModel(this AppointmentResourceViewModel model)
        {
            if (model == null)
            {
                return(null);
            }
            var entity = new AppointmentResourceModel
            {
                AppointmentID         = model.AppointmentID,
                AppointmentResourceID = model.AppointmentResourceID,
                ResourceID            = model.ResourceID,
                ResourceTypeID        = model.ResourceTypeID,
                ParentID   = model.ParentID,
                ModifiedOn = model.ModifiedOn,
                IsActive   = model.IsActive,
                IsNoShow   = model.IsNoShow
            };

            return(entity);
        }
        /// <summary>
        /// To the view model.
        /// </summary>
        /// <param name="entity">The entity.</param>
        /// <returns></returns>
        public static AppointmentResourceViewModel ToViewModel(this AppointmentResourceModel entity)
        {
            if (entity == null)
            {
                return(null);
            }

            var model = new AppointmentResourceViewModel
            {
                AppointmentID         = entity.AppointmentID,
                AppointmentResourceID = entity.AppointmentResourceID,
                ResourceID            = entity.ResourceID,
                ResourceTypeID        = entity.ResourceTypeID,
                ParentID                  = entity.ParentID,
                ModifiedOn                = entity.ModifiedOn,
                IsActive                  = entity.IsActive,
                IsNoShow                  = entity.IsNoShow,
                AppointmentStatusID       = entity.AppointmentStatusID,
                GroupHeaderID             = entity.GroupHeaderID,
                AppointmentStatusDetailID = entity.AppointmentStatusDetailID
            };

            return(model);
        }
 public Response <AppointmentResourceViewModel> UpdateAppointmentNoShow(AppointmentResourceViewModel appointmentResource)
 {
     return(appointmentRepository.UpdateAppointmentNoShow(appointmentResource));
 }