public ActionResult Edit(int id, Transaction transaction)
 {
     _transactionService.UpdateTransaction(transaction);
     return RedirectToAction("Index", new {year = transaction.Date.Year, month = transaction.Date.Month});
 }
 public ActionResult Create(Transaction transaction)
 {
     _transactionService.InsertTransaction(transaction);
     return RedirectToAction ("Index", new { year = transaction.Date.Year, month = transaction.Date.Month });
 }
        public void UpdateTransaction(Transaction transaction)
        {
            var data = GetTransactionById (transaction.Id);
            if (data == null)
                return;

            transaction.Updated_At = DateTime.Now;
            transaction.Created_At = data.Created_At;

            _transactionRepo.Update(transaction);
        }
 public TransactionViewModel()
 {
     Transaction = new Transaction(){ Date = DateTime.Now };
     CategorySelectList = new List<SelectListItem>();
 }
 public void InsertTransaction(Transaction transaction)
 {
     transaction.Created_At = DateTime.Now;
     transaction.Updated_At = DateTime.Now;
     _transactionRepo.Insert(transaction);
 }