Beispiel #1
0
        public void AddCredit([FromBody] Credit credit)
        {
            var data = TransactionList.Load(FilePath);

            data.Add(credit);
            data.Sort();
            data.Save(FilePath);
        }
Beispiel #2
0
        public void AddDebit([FromBody] Debit debit)
        {
            var data = TransactionList.Load(FilePath);

            data.Add(debit);
            data.Sort();
            data.Save(FilePath);
        }
Beispiel #3
0
        // GET: api/GetTransactionsByDateRange
        public TransactionList GetTransactionsByDateRange(DateTime start, DateTime end)
        {
            var data = TransactionList.Load(FilePath).AsQueryable();

            return(new TransactionList(data.Where(t => t.Date >= start && t.Date <= end).ToList())); // return only when date falls between start and end, don't include totals, sort as above
        }
Beispiel #4
0
        // GET: api/GetDebitsByType
        public TransactionList GetDebitsByType(DebitTypeEnum debitType)
        {
            var data = TransactionList.Load(FilePath).AsQueryable();

            return(new TransactionList(data.Where(t => (t is Debit) && (t as Debit).DebitType == debitType).ToList())); // return only transcations where credit type is included in credit type enum, sort as above
        }
Beispiel #5
0
 // GET: api/GetAllTransactions
 public TransactionList GetAllTransactions()
 {
     return(TransactionList.Load(FilePath));
 }