protected override async void OnAppearing() { base.OnAppearing(); try { _record = await ViewModel.GetFormGroupsAsync(); } catch (Exception ex) { Debug.WriteLine($"Exception in FormGroupList.xaml.cs -> OnAppearing(): Message: {ex.Message}"); await DisplayAlert(Constants.ErrorMsgTitleOops, Constants.ErrorMsgSorry, "OK"); } if (_record != null) { ac.IsVisible = false; stkFinal.IsVisible = true; listForms.ItemsSource = _record.FormGroups; this.BackgroundColor = Color.White; this.Opacity = 1; } }
public async Task <Domain.Models.ResponseModels.FormGroupGroupingsModel> GetFormGroupsAsync() { Domain.Models.RequestModels.FormGroupModel domainUser = new Domain.Models.RequestModels.FormGroupModel() { LocationID = Settings.GetLocationID(), FaciltyID = Settings.GetFacilityID() }; SetBaseProperties(domainUser); // Call REST service Domain.Models.ResponseModels.FormGroupGroupingsModel res = await _authService.GetFormGroupsAsync(domainUser); return(res); }
public async Task <Domain.Models.ResponseModels.FormGroupGroupingsModel> GetFormGroupsAsync( Domain.Models.RequestModels.FormGroupModel formGroupRequest) { Domain.Models.ResponseModels.FormGroupGroupingsModel result = null; try { var client = new HttpClient(); client.BaseAddress = new Uri(Settings.GetBaseUrl()); var data = JsonConvert.SerializeObject(formGroupRequest); var content = new StringContent(data, Encoding.UTF8, "application/json"); HttpResponseMessage response = await client.PostAsync(Settings.GetBaseUrl() + "/efr/groups", content); result = JsonConvert.DeserializeObject <Domain.Models.ResponseModels.FormGroupGroupingsModel>( response.Content.ReadAsStringAsync().Result); } catch (Exception erf) { Debug.Write(erf); } return(result); }