public List <Transaction> GetTransactions(Wallet wallet) { _transactionView = new TransactionView(); var transactions = _transactionView.GetRequests(10).Result; foreach (var transaction in transactions) { var dateTime = DateTimeOffset.Parse(transaction.Paid_At, CultureInfo.InvariantCulture); transaction.Paid_At = dateTime.DateTime.ToLongDateString(); } var transactionsForWallet = transactions.Where(x => x.Currency.Name.Contains(wallet.Currency.Name)); return(transactionsForWallet.ToList()); }
private async void BtnSend_Clicked(object sender, EventArgs e) { _transactionView = new TransactionView(); var transaction = new Transaction(); var user = (User)SuggestedUsers.SelectedItem; transaction.Amount = float.Parse(txtAmount.Text, CultureInfo.InvariantCulture); transaction.Currency = SelectedWallet.Currency; transaction.To_User = user; if (transaction.Amount < 0) { await DisplayAlert("Validation errors", "Please provide correct Amount", "Ok"); return; } if (string.IsNullOrEmpty(SuggestedUsers.SelectedItem.ToString())) { await DisplayAlert("Validation errors", "The User Name is required", "Ok"); return; } var result = await _transactionView.CreateRequest(transaction); var output = await result.Content.ReadAsStringAsync(); if (result.IsSuccessStatusCode) { await DisplayAlert("Transaction completed", "Transaction completed", "Ok"); await Navigation.PushModalAsync(new MainPage()); } else { try { var response = JsonConvert.DeserializeObject <List <Output> >(output); await DisplayAlert("Something went wrong", response[0].Detail[0].ToString(), "Ok"); } catch { await DisplayAlert("Something went wrong", output, "Ok"); } } }