public void DeleteDebt(Debt debt) { ALLOutlays = ALLOutlays.Where(x => x.DebtId != debt.Id).ToList(); ALLDebts = ALLDebts.Where(x => x.Id != debt.Id).ToList(); RefreshAll(); DBhelper.Delete(debt); }
public void SelectOutlaysByDebt(Debt debt) { Outlays.Clear(); var debtChildren = ALLOutlays.Where(outlay => outlay.DebtId == debt.Id); TotalMoneySpent = 0; foreach (var item in debtChildren) { this.Outlays.Add(item); TotalMoneySpent += item.Price; } }
public void AddDebt(string debtor, DateTime returnDate, int interestRate, List <Outlay> outlays) { var Debt = new Debt { Debtor = debtor, ReturnDate = returnDate, InterestRate = interestRate, Outlays = outlays }; ALLDebts.Add(Debt); Debts.Add(Debt); DBhelper.Insert(Debt); DBhelper.UpdateWithChildren(Debt); }
public void DeleteDebt(Debt debt) { db.Table <Outlay>().Delete(v => v.DebtId.Equals(debt.Id)); Delete(debt); }