/// <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()); }
/// <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); }
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."); }
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."); }
/// <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); }
public Response <AppointmentContactViewModel> UpdateAppointmentContact(AppointmentContactViewModel appointmentContact) { return(appointmentRepository.UpdateAppointmentContact(appointmentContact)); }
public JsonResult UpdateAppointmentContact(AppointmentContactViewModel appointmentContact) { return(Json(appointmentRepository.UpdateAppointmentContact(appointmentContact))); }