public void AddCredit([FromBody] Credit credit) { var data = TransactionList.Load(FilePath); data.Add(credit); data.Sort(); data.Save(FilePath); }
public void AddDebit([FromBody] Debit debit) { var data = TransactionList.Load(FilePath); data.Add(debit); data.Sort(); data.Save(FilePath); }
// 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 }
// 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 }
// GET: api/GetAllTransactions public TransactionList GetAllTransactions() { return(TransactionList.Load(FilePath)); }