public IActionResult AddDepositAction(CashDepositAddActionViewModel model)
 {
     if (ModelState.IsValid)
     {
         decimal before = model.CurrentAmount;
         decimal after  = 0.00m;
         if (model.isPayment)
         {
             after = before - model.Amount;
         }
         else
         {
             after = before + model.Amount;
         }
         CashDepositAction action = new CashDepositAction
         {
             Id                 = Guid.NewGuid(),
             isPayment          = model.isPayment,
             Amount             = model.Amount,
             InvoiceNo          = model.InvoiceNo,
             ActionDate         = model.ActionDate,
             AmountBeforeAction = before,
             AmountAfterAction  = after,
             CashDepositId      = model.DepositId,
             Description        = model.Description
         };
         CashDeposit deposit = _cashDepositsRepository.GetCashDeposit(model.DepositId);
         deposit.CurrentAmount = after;
         _cashDepositsRepository.Update(deposit);
         _cashDepositActionsRepository.Add(action);
         return(RedirectToAction("DepositDetails", new { id = model.DepositId }));
     }
     return(RedirectToAction("Index"));
 }
        public ViewResult AddDepositAction(Guid id)
        {
            var deposit = _cashDepositsRepository.GetCashDeposit(id);
            var model   = new CashDepositAddActionViewModel
            {
                DepositId     = id,
                CurrentAmount = deposit.CurrentAmount
            };

            return(View(model));
        }