Ejemplo n.º 1
0
        public IActionResult AddTransaction()
        {
            var banks = _bankAppService.GetAll()
                        .Select(bank => new SelectListItem
            {
                Value = bank.BankCode.ToString(),
                Text  = bank.Name
            }).ToList();

            ViewData["ListBanks"] = banks;

            var parentsTrees = _parentTreeAppService.GetAll()
                               .Select(tree => new SelectListItem
            {
                Value = tree.Id.ToString(),
                Text  = tree.Title
            }).ToList();

            ViewData["ParentsTrees"] = parentsTrees;

            Array values = Enum.GetValues(typeof(ETransactionType));
            var   items  = new List <SelectListItem>();

            foreach (var i in values)
            {
                items.Add(new SelectListItem
                {
                    Text  = EnumHelper.GetDescription <ETransactionType>((ETransactionType)i),
                    Value = i.ToString()
                });
            }

            ViewData["TransactionTypes"] = items;
            return(View());
        }
Ejemplo n.º 2
0
 public async Task <IActionResult> GetAll()
 {
     try
     {
         return(Ok(new ResponceViewModel <IEnumerable <BankViewModel> >(await bankService.GetAll())));
     }
     catch (Exception ex)
     {
         logger.LogError($"Exception thrown in get all banks: {ex}");
         return(BadRequest(new ResponceViewModel <string>($"Get banks failed. {ex.Message}")));
     }
 }
Ejemplo n.º 3
0
        public JsonResult GetAjaxHandlerMyBanks()
        {
            var banks = _bankAppService.GetAll();

            var banksVM = banks.Select(x => new BankVM(x)).ToList();

            return(Json(new
            {
                aaData = banksVM,
                success = true
            }));
        }