Пример #1
0
        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);
        }
Пример #2
0
        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;
            }
        }
Пример #3
0
        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);
        }
Пример #4
0
 public void DeleteDebt(Debt debt)
 {
     db.Table <Outlay>().Delete(v => v.DebtId.Equals(debt.Id));
     Delete(debt);
 }