public async Task <CheckingDeposit> AddCheckingDepositAsync(CheckingDeposit deposit) { var inserted = await connection.InsertAsync(deposit); //deposit.IsNew = false; return(deposit); }
public async Task DeleteCheckingDepositAsync(CheckingDeposit deposit) { if (context.CheckingDeposit.Any(d => d.id == deposit.id)) { await Task.Run(() => context.CheckingDeposit.Attach(deposit)); await Task.Run(() => context.Entry(deposit).State = Microsoft.EntityFrameworkCore.EntityState.Deleted); if (deposit.checkingAccount != null) { await Task.Run(() => context.Entry(deposit.checkingAccount).State = Microsoft.EntityFrameworkCore.EntityState.Modified); } } }
public async Task UpdateCheckingDepositAsync(CheckingDeposit deposit) { if (context.CheckingDeposit.Any(c => c.id == deposit.id)) { await Task.Run(() => context.CheckingDeposit.Attach(deposit)); await Task.Run(() => context.Entry(deposit).State = Microsoft.EntityFrameworkCore.EntityState.Modified); if (deposit.checkingAccount != null) { await Task.Run(() => context.Entry(deposit.checkingAccount).State = Microsoft.EntityFrameworkCore.EntityState.Modified); } } else { throw new Exception("Unable to locate existing Checking Deposit record with provided Primary Key value"); } }
public async Task PopulateVMAsync(CheckingDeposit deposit) { this.model = deposit; this.accountModel = deposit.checkingAccount; this.ItemId = this.model.id; this.ItemType = AccountItemType.Deposits; this.ItemAmount = model.transactionAmount; this.EndingBalance = model.endingBalance; this.ItemDescription = model.description; this.Description = this.model.description; this.TransactionDate = deposit.transactionDate > DateTime.MinValue ? deposit.transactionDate : DateTime.Now; this.ItemDate = this.TransactionDate; this.TransactionAmount = model.transactionAmount; this.ObjectColorCode = this.model.ColorCode; this.BudgetItemId = model.budgetIncomeId; //await LoadBudgetData(); }
async Task <CheckingDepositViewModel> AddCheckingDepositAsync() { CheckingDepositViewModel vm = new CheckingDepositViewModel(this.dbFilePath); vm.IsNew = true; vm.CanEdit = true; vm.CanDelete = false; vm.ItemType = AccountRegisterItemViewModel.AccountItemType.Deposits; CheckingDeposit deposit = new CheckingDeposit(); deposit.checkingAccount = model as CheckingAccount; deposit.checkingAccountId = model.id; await vm.PopulateVMAsync(deposit); return(vm); }
public async Task <CheckingDeposit> AddCheckingDepositAsync(CheckingDeposit deposit) { if (!context.CheckingDeposit.Any(d => d.id == deposit.id)) { await Task.Run(() => context.CheckingDeposit.Add(deposit)); await Task.Run(() => context.Entry(deposit).State = Microsoft.EntityFrameworkCore.EntityState.Added); await Task.Run(() => context.Entry(deposit.checkingAccount).State = Microsoft.EntityFrameworkCore.EntityState.Modified); if (deposit.budgetIncome != null) { await Task.Run(() => context.Entry(deposit.budgetIncome).State = Microsoft.EntityFrameworkCore.EntityState.Unchanged); } } else { throw new Exception("A deposit record already exists with the same Primary Key value"); } return(deposit); }
public void Put(int id, [FromBody] CheckingDeposit item) { throw new NotImplementedException(); }
public async Task UpdateCheckingDepositAsync(CheckingDeposit deposit) { var updated = await connection.UpdateAsync(deposit); }
public async Task <CheckingDeposit> GetCheckingDepositAsync(int id) { CheckingDeposit deposit = await connection.FindAsync <CheckingDeposit>(id); return(deposit); }
public async Task DeleteCheckingDepositAsync(CheckingDeposit deposit) { var deleted = await connection.DeleteAsync(deposit); }