// GET: Deposits public async Task <IActionResult> Index(string?searchCurrency, decimal?searchAmount) { var deposits = await _depositService.Get(); ViewBag.CurrencyEnums = typeof(Currency); deposits = await _depositService.GetFilteredDeposits(searchCurrency, searchAmount); if (searchAmount != null) { if (deposits.Count() > 1) { Alert($"You Have found {deposits.Count()} Deposits", NotificationType.success); } else if (deposits.Count() == 1) { Alert("You Have found 1 Deposit", NotificationType.success); } else { Alert("Sorry, There is no such a kind of Deposit", NotificationType.info); } } var Deposit = _mapper.Map <IEnumerable <Deposit> >(deposits.ToList()); return(View(Deposit)); }
// GET api/deposit/5 public IHttpActionResult Get(int id) { try { return(Ok(_depositService.Get(id))); } catch (BankClientException ex) { return(BadRequest(ex.Message)); } catch (Exception ex) { return(InternalServerError(ex)); } }
public async Task <IEnumerable <Deposit> > GetDepositsList(string orderBy) { var depositsList = await _depositService.Get(); if (orderBy != null) { var isColumnValid = SortingDictionaries.DepositSortings.TryGetValue(orderBy, out var sortFunc); if (isColumnValid) { depositsList = orderBy.Contains("Desc") ? depositsList.OrderByDescending(sortFunc) : depositsList.OrderBy(sortFunc); } } return(depositsList); }
// GET: Accounts/Details/5 public async Task <IActionResult> Details(int id) { var account = await _account.GetById(id); if (account == null) { return(NotFound()); } var loans = await _loanService.Get(); ViewBag.loans = loans; var deposits = await _depositService.Get(); ViewBag.deposits = deposits; return(View(account)); }
public IHttpActionResult GetCapitalizationPlan(DepositModelForCapitalizationPlan request) { try { var deposit = depositService.Get(request.DepositId); validationService.ValidateSum(request.Sum, deposit.MinSum, deposit.MaxSum, ModelState); validationService.ValidateMonthCount(request.MonthCount, deposit.MinMonthPeriod, deposit.MaxMonthPeriod, ModelState); if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var plan = calculationDepositService.CalculateCapitalizationPlan(request.Sum, request.PercentRate, request.MonthCount, request.StartDate).ToList(); return(Ok(plan)); } catch (BankClientException ex) { return(BadRequest(ex.Message)); } catch (Exception ex) { return(InternalServerError(ex)); } }
public async Task <IActionResult> Details(int depositId) { var deposit = await _depositService.Get(depositId); return(View(deposit)); }