public ObservableCollection<AccountViewModel> getAccounts() { ObservableCollection<AccountViewModel> accounts = new ObservableCollection<AccountViewModel>(); using (SQLite.SQLiteConnection db = new SQLite.SQLiteConnection(app.DBPath)) { var results = db.Table<Account>().OrderBy(a => a.Id); foreach (Account _account in results) { AccountViewModel account = new AccountViewModel(_account.Id, _account.DateCreated); account.Name = _account.Name; account.Type = _account.Type; account.Description = _account.Description; account.CurrentBalance = _account.CurrentBalance; accounts.Add(account); } } return accounts; }
private async void SaveRevenueButton_Click(object sender, RoutedEventArgs e) { AccountViewModel newAccount = new AccountViewModel(); newAccount.Name = AccountName.Text; newAccount.Description = AccountNotes.Text; int accountTypeInt = Int32.Parse(((ListItem) AccountType.SelectedItem).Value); newAccount.Type = (Models.AccountType)accountTypeInt; string currentAmountString = AccountStartingAmount.Text.Replace("$", "").TrimStart(); double amount; if (Double.TryParse(currentAmountString, out amount)) { newAccount.CurrentBalance = amount; } if (newAccount.IsValid()) { await newAccount.Save(); AddAccountPopup.IsOpen = false; InitializeAccountItems(); } }
public AccountViewModel getAccount(int accountId) { AccountViewModel account = new AccountViewModel(); return account; }