// GET: CommunicationUpdatesAppointments/Create public ActionResult Index(string appointmentExternalID = "", string method = "", bool?alreadySent = null) { var viewModel = new GenericModel <AppointmentUpdateModel>(); try { viewModel.SearchResults = CommunicationUpdatesAppointmentsProvider.Search(Helpers.GetAuthenticator(), appointmentExternalID, method, alreadySent); viewModel.Header = Resources.ResultsHeader; viewModel.ListEmptyMessage = viewModel.SearchResults != null && viewModel.SearchResults.Rows.Count() > 0 ? string.Empty : Resources.ListEmptyMessage; } catch (Exception ex) { viewModel.ErrorMessage = ex.GetBaseException().Message; } viewModel.Criteria.Add("AppointmentExternalID", appointmentExternalID); viewModel.Criteria.Add("AlreadySent", alreadySent.ToString()); viewModel.Criteria.Add("Method", method); return(View("Index", viewModel)); }
public ActionResult Send(MarkAsReceivedModel viewModel) { viewModel.ResultMessage = string.Empty; Guid markAsReceivedID; if (!Guid.TryParse(viewModel.MarkAsReceivedID, out markAsReceivedID)) { viewModel.Success = false; viewModel.ResultMessage = "Please provide a valid ID."; return(View("Index", viewModel)); } Api.Models.MarkAsReceived.MarkAsReceivedModel result; try { switch (viewModel.ObjectType) { case "Appointment cancel request": result = AppointmentCancelRequestProvider.MarkAsReceived(Helpers.GetAuthenticator(), new Api.Models.MarkAsReceived.MarkAsReceivedModel { InternalID = markAsReceivedID }); viewModel.ResultMessage = result.ResultMessage; viewModel.Success = result.Success; break; case "Appointment request": result = AppointmentRequestProvider.MarkAsReceived(Helpers.GetAuthenticator(), new Api.Models.MarkAsReceived.MarkAsReceivedModel { InternalID = markAsReceivedID }); viewModel.ResultMessage = result.ResultMessage; viewModel.Success = result.Success; break; case "Appointment update": result = CommunicationUpdatesAppointmentsProvider.MarkAsReceived(Helpers.GetAuthenticator(), new Api.Models.MarkAsReceived.MarkAsReceivedModel { InternalID = markAsReceivedID }); viewModel.ResultMessage = result.ResultMessage; viewModel.Success = result.Success; break; case "Communication update": result = PatientCommunicationProvider.MarkAsReceived(Helpers.GetAuthenticator(), new Api.Models.MarkAsReceived.MarkAsReceivedModel { InternalID = markAsReceivedID }); viewModel.ResultMessage = result.ResultMessage; viewModel.Success = result.Success; break; case "Patient update": result = CommunicationUpdatesPatientsProvider.MarkAsReceived(Helpers.GetAuthenticator(), new Api.Models.MarkAsReceived.MarkAsReceivedModel { InternalID = markAsReceivedID }); viewModel.ResultMessage = result.ResultMessage; viewModel.Success = result.Success; break; case "Order update": result = CommunicationUpdatesOrdersProvider.MarkAsReceived(Helpers.GetAuthenticator(), new Api.Models.MarkAsReceived.MarkAsReceivedModel { InternalID = markAsReceivedID }); viewModel.ResultMessage = result.ResultMessage; viewModel.Success = result.Success; break; default: viewModel.Success = false; viewModel.ResultMessage = "Please select an object type."; break; } } catch (Exception ex) { viewModel.ResultMessage = ex.GetBaseException().Message; } return(View("Index", viewModel)); }