public async Task <FetchFifteenCallsRespnse> FetchFifteenCalls(FifteenCallsRequestModel requestModel) { FetchFifteenCallsRespnse fetchFifteenCallsResponse = new FetchFifteenCallsRespnse(); try { fetchFifteenCallsResponse = await Post <FetchFifteenCallsRespnse, FifteenCallsRequestModel>(FetchFifteenCallsInterpreterAPI, requestModel); } catch (Exception e) { System.Diagnostics.Debug.WriteLine(e.Message); } return(fetchFifteenCallsResponse); }
public async Task LoadData(String fromDate, String minDay, String maxDay, UserTypes userType) { IsLoading = true; _minDay = minDay; _maxDay = maxDay; _userType = userType; var fifteenCallsRequestModel = new FifteenCallsRequestModel(); fifteenCallsRequestModel.FromDate = fromDate; fifteenCallsRequestModel.MinDay = minDay; fifteenCallsRequestModel.MaxDay = maxDay; FetchFifteenCallsRespnse response = null; FetchFifteenCallsABResponse ABresponse = null; switch (userType) { case UserTypes.Interpreter: InterpreterService interpreterService = new InterpreterService(); response = await interpreterService.FetchFifteenCalls(fifteenCallsRequestModel); break; case UserTypes.Client: ClientService clientService = new ClientService(); response = await clientService.FetchFifteenCalls(fifteenCallsRequestModel); break; case UserTypes.Business: BusinessService businessService = new BusinessService(); if (Business != null) { fifteenCallsRequestModel.ClientBusinessId = int.Parse(Business.ClientBusinessId); ABresponse = await businessService.FetchFifteenCalls(fifteenCallsRequestModel); } break; case UserTypes.Agency: AgencyService agencyService = new AgencyService(); if (Agency != null) { fifteenCallsRequestModel.AgencyId = int.Parse(Agency.InterpreterBusinessId); ABresponse = await agencyService.FetchFifteenCalls(fifteenCallsRequestModel); } break; } if (response != null) { foreach (var call in response.Calls) { CallLogs.Add(call); } } if (ABresponse != null && ABresponse.Call != null) { foreach (var call in ABresponse.Call.Calls) { CallLogs.Add(call); } } IsLoading = false; }