Ejemplo n.º 1
0
 public ActionResult EmployeeDetails(int depositId)
 {
     ViewBag.CurrentDate = dateService.GetCurrentDate().Date;
     var deposit = depositService.GetDepositById(depositId);
     if (deposit == null)
     {
         return new HttpNotFoundResult();
     }
     var cache = MemoryCache.Default;
     var refreshCode = cache.Get("RefreshCode");
     if (refreshCode == null)
     {
         refreshCode = new RefreshCodeModel();
     }
     deposit.ReturnCodeModel = (RefreshCodeModel)refreshCode;
     return View(deposit);
 }
Ejemplo n.º 2
0
 public ActionResult RefreshCode(RefreshCodeModel model)
 {
     if (ModelState.IsValid)
     {
         var cache = MemoryCache.Default;
         cache.Remove("RefreshCode");
         cache.Add("RefreshCode", model, DateTimeOffset.UtcNow.AddMinutes(8000));
     }
     return View(model);
 }
Ejemplo n.º 3
0
 public ActionResult EmployeeDetails(int creditId)
 {
     var currentDate = dateService.GetCurrentDate();
     ViewBag.CurrentDate = currentDate.Date;
     var credit = creditService.GetCreditById(creditId);
     if (credit == null)
     {
         return new HttpNotFoundResult();
     }
     try
     {
         if (credit.EndDate > currentDate)
         {
             credit.MonthlyPayment = creditService.CalculateMonthPayment(credit.StartAmount, credit.CreditType.ReturnTerm, credit.CreditType.Percent);
         }
         else
         {
             credit.MonthlyPayment = null;
         }
         var cache = MemoryCache.Default;
         var refreshCode = cache.Get("RefreshCode");
         if (refreshCode == null)
         {
             refreshCode = new RefreshCodeModel(); 
         }
         credit.ReturnCodeModel = (RefreshCodeModel) refreshCode;
     }
     catch (Exception)
     {
         credit.MonthlyPayment = null;
     }
     return View(credit);
 }
Ejemplo n.º 4
0
 public ActionResult RefreshCode()
 {
     var cache = MemoryCache.Default;
     var currencyModel = cache.Get("RefreshCode");
     if (currencyModel == null)
     {
         currencyModel = new RefreshCodeModel();
         ;
     }
     return View(currencyModel);
 }