コード例 #1
0
        /// <summary>
        /// Updates the appointment contact.
        /// </summary>
        /// <param name="appointmentContact">The appointment contact.</param>
        /// <returns></returns>
        public Response <AppointmentContactViewModel> UpdateAppointmentContact(AppointmentContactViewModel appointmentContact)
        {
            const string apiUrl = baseRoute + "UpdateAppointmentContact";

            return
                (communicationManager.Put <AppointmentContactModel, Response <AppointmentContactModel> >(appointmentContact.ToModel(), apiUrl)
                 .ToViewModel());
        }
コード例 #2
0
        /// <summary>
        /// Converts viewmodel to model
        /// </summary>
        /// <param name="model">The model.</param>
        /// <returns></returns>
        public static AppointmentContactModel ToModel(this AppointmentContactViewModel model)
        {
            if (model == null)
            {
                return(null);
            }
            var entity = new AppointmentContactModel
            {
                AppointmentContactID = model.AppointmentContactID,
                AppointmentID        = model.AppointmentID,
                ContactID            = model.ContactID,
                ModifiedOn           = model.ModifiedOn
            };

            return(entity);
        }
コード例 #3
0
        public void AddAppointmentContact_Failed()
        {
            // Arrange
            var appointmentContact = new AppointmentContactViewModel
            {
                AppointmentID = -1,
                ContactID     = -1
            };

            // Act
            var result   = controller.AddAppointmentContact(appointmentContact);
            var response = result as Response <AppointmentContactViewModel>;

            // Assert
            Assert.IsTrue(response != null, "Response can't be null");
            Assert.IsTrue(response.ResultCode != 0, "Add appointment contact expected to be failed.");
        }
コード例 #4
0
        public void AddAppointmentContact_Success()
        {
            // Arrange
            var appointmentContact = new AppointmentContactViewModel
            {
                AppointmentID = 1,
                ContactID     = 1
            };

            // Act
            var result   = controller.AddAppointmentContact(appointmentContact);
            var response = result as Response <AppointmentContactViewModel>;

            // Assert
            Assert.IsTrue(response != null, "Response can't be null");
            Assert.IsTrue(response.ResultCode == 0, "Appointment contact could not be created.");
        }
コード例 #5
0
        /// <summary>
        /// To the view model.
        /// </summary>
        /// <param name="entity">The entity.</param>
        /// <returns></returns>
        public static AppointmentContactViewModel ToViewModel(this AppointmentContactModel entity)
        {
            if (entity == null)
            {
                return(null);
            }

            var model = new AppointmentContactViewModel
            {
                AppointmentContactID = entity.AppointmentContactID,
                AppointmentID        = entity.AppointmentID,
                ContactID            = entity.ContactID,
                ModifiedOn           = entity.ModifiedOn
            };

            return(model);
        }
コード例 #6
0
 public Response <AppointmentContactViewModel> UpdateAppointmentContact(AppointmentContactViewModel appointmentContact)
 {
     return(appointmentRepository.UpdateAppointmentContact(appointmentContact));
 }
コード例 #7
0
 public JsonResult UpdateAppointmentContact(AppointmentContactViewModel appointmentContact)
 {
     return(Json(appointmentRepository.UpdateAppointmentContact(appointmentContact)));
 }