public IActionResult SaveTransaction(QuickTransactionViewModel vm)
        {
            if (ModelState.IsValid == false)
            {
                vm.SelectedTransaction = accountsService.GetQuickTransactionDef(long.Parse(vm.SelectedTransaction)).Name;

                var accountHeads = accountsService.GetAllAccountHeadsByCurrency(HttpContext.Session.GetString("Currency"));
                var accountHeadsList = new SelectList(accountHeads, "AccountHeadId", "Name");
                vm.AccountHeads = accountHeadsList;

                return View("CreateTransaction", vm); 
            }

            Journal item = new Journal()
            {
                Amount = vm.Amount,
                CrAccountHeadId = vm.CrAccountHeadId,
                DrAccountHeadId = vm.DrAccountHeadId,
                Narration = vm.Narration,
                TransactionDate = vm.TransactionDate,
                ModifiedBy = "testuser", // TODO: replace with log in user id
                ModifiedDate = DateTime.Now
            };

            journalService.CreateJournal(item);

            return View("TransactionResult", item);
        }
        public IActionResult CreateTransaction(QuickTransactionSelectionVM vm)
        {
            var selectedTransaction = accountsService.GetQuickTransactionDef(long.Parse(vm.SelectedTransaction));
            var accountHeads = accountsService.GetAllAccountHeadsByCurrency(HttpContext.Session.GetString("Currency"));
            var accountHeadsList = new SelectList(accountHeads, "AccountHeadId", "Name");

            var newVM = new QuickTransactionViewModel()
            {
                SelectedTransaction = selectedTransaction.Name,
                CrAccountHeadId = selectedTransaction.FromAccountHeadId.Value,
                DrAccountHeadId = selectedTransaction.ToAccountHeadId.Value,
                Amount = selectedTransaction.DefaultAmount,
                Narration = string.Format(selectedTransaction.NarrationTemplate, DateTime.Now),
                TransactionDate = DateTime.Today,
                AccountHeads = accountHeadsList
            };

            return View(newVM);
        }