private async void CancelScheduledServices() { if (this.serviceType.Equals(ServiceType.DoctorHome)) { if (await dialogService.ShowConfirm(AppResources.CancelMedicalHomeService, string.Format(AppResources.MessageCancelMedigalHomeService, UserNameModified))) { dialogService.ShowProgress(); RequestCancelMedicalHomeService request = new RequestCancelMedicalHomeService { IdService = IdService, }; ResponseCancelMedicalHomeService response = await apiService.CancelMedicalHomeService(request); dialogService.HideProgress(); ValidateResponseCancelMedicalHomeService(response); } } else { #region original if (await dialogService.ShowConfirm(AppResources.TitleSheduledServices, AppResources.CancelSheduledService)) { dialogService.ShowProgress(); ResponseLogin user = ServiceLocator.Current.GetInstance <ILoginViewModel>().User; int.TryParse(user.DocumentType, out int applicantDocumentType); RequestCancelService request = new RequestCancelService { Code = Code, Document = user.Document, DocumentType = user.DocumentType, PendingCoordination = Coordination, ServiceType = ServiceType.ToString(), applicant = new Applicant { ApplicantCellPhone = user.CellPhone, ApplicantDocument = user.Document, ApplicantDocumentType = applicantDocumentType, ApplicantDocumentTypeName = user.DocumentTypeName, ApplicantLastNameOne = user.LastNameOne, ApplicantLastNameTwo = user.LastNameTwo, ApplicantMail = user.UserName, ApplicantNameOne = user.NameOne, ApplicantNameTwo = user.NameTwo } }; ResponseCancelService response = await apiService.CancelService(request); dialogService.HideProgress(); ValidateResponseCancelService(response); } #endregion } }
private async void ValidateResponseCancelService(ResponseCancelService response) { await dialogService.ShowMessage(response.Title, response.Message); if (response.Success && response.StatusCode == 0) { IScheduledServicesPageViewModel scheduledServicesPageViewModel = ServiceLocator.Current.GetInstance <IScheduledServicesPageViewModel>(); scheduledServicesPageViewModel.LoadScheduledServices(); } }