public async Task GetCustomerAccountsbyPhoneNumber(string telephone) { try { CheckConnectivity(); ShowReloadCustomerAccounts = false; CustomerAccountsErrorMsg = ""; CardLoading = true; List <CustomerAccount> customerAccounts = await GlobalStaticFields.Customer.GetAccountsbyPhoneNumber(telephone); if (customerAccounts?.Count > 0) { CustomerAccounts.ReplaceRange(customerAccounts); //await GlobalStaticFields.Customer.GetCards(false); } } catch (WebException e) { ShowReloadCustomerAccounts = true; CustomerAccountsErrorMsg = "connection timed out"; } catch (Exception ex) { ShowReloadCustomerAccounts = true; CustomerAccountsErrorMsg = "An error occurred"; } finally { IsAccountLoaded = true; CardLoading = false; } }
public async Task GetCustomerAccountsbyPhoneNumber(string telephone) { try { CheckConnectivity(); //CardLoading = true; List <CustomerAccount> customerAccounts = await GlobalStaticFields.Customer.GetAccountsbyPhoneNumber(telephone); List <ProfileListAccount> profileListAccounts = new List <ProfileListAccount>(); if (customerAccounts?.Count > 0) { CustomerAccounts.ReplaceRange(customerAccounts); if (CustomerAccounts?.Count > 0) { foreach (var item in CustomerAccounts) { var profileAcc = new ProfileListAccount { nuban = item.nuban, AccountType = item.accountType, BalanceWithCurrency = $"{Utilities.GetCurrency(item.currencyCode)}{item.balance}" }; profileListAccounts.Add(profileAcc); } profileListAccount.ReplaceRange(profileListAccounts); } //await GlobalStaticFields.Customer.GetCards(false); } //var apirequest = new ApiRequest(); //dynamic accts = new JObject(); //accts.phone = telephone; //var request = await apirequest.Post<dynamic>(accts, "", URLConstants.SwitchApiLiveBaseUrl, "Switch/GetAllOtherAcctDetailsByNumber", "BankAccountsViewModel"); //if (request.IsSuccessStatusCode) //{ // var response = await request.Content.ReadAsStringAsync(); // List<CustomerAccount> content = JsonConvert.DeserializeObject<List<CustomerAccount>>(response); // if (content?.Count > 0) // CustomerAccounts.ReplaceRange(content); //} //else //{ // var response = await request.Content.ReadAsStringAsync(); //} } catch (Exception ex) { } finally { IsAccountLoaded = true; // CardLoading = false; } }