Exemplo n.º 1
0
        public ActionResult LoanAcctHist(int id)
        {
            try
            {
                if (id == 0)
                {
                    return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
                }
                var getLoanAccount = context.GetClientLoanAccts(Global.AccountName).FirstOrDefault();
                ViewBag.AcctNo          = getLoanAccount.AccountNumber;
                ViewBag.ProdDescription = getLoanAccount.ProductName;
                ViewBag.Balance         = getLoanAccount.PrincipalBalance;
                int cifkey = Convert.ToInt32(getLoanAccount.IDX);

                var getLoanAccountLedger = context.GetClientLoanAcctLedger(getLoanAccount.AccountNumber, cifkey);
                ViewBag.totalPrincipalPaid = getLoanAccountLedger.Sum(i => i.Principal);
                ViewBag.totalInterestPaid  = getLoanAccountLedger.Sum(i => i.Interest);
                ViewBag.totalPenalty       = getLoanAccountLedger.Sum(i => i.Penalty);
                ViewBag.countPrincipalPaid = getLoanAccountLedger.Count(i => i.Principal != 0);
                ViewBag.countInterestPaid  = getLoanAccountLedger.Count(i => i.Interest != 0);
                ViewBag.countPenalty       = getLoanAccountLedger.Count(i => i.Penalty != 0);
                return(View(getLoanAccountLedger));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }