예제 #1
0
        public List <BanksViewModel> GetBanks(BankForm form)
        {
            try
            {
                var dbBanks = _db.GetBanks(form.CityId).ToList();
                Mapper.CreateMap <GetBanks_Result, BanksViewModel>()
                .ForMember(vm => vm.Logo, opt => opt.MapFrom(src => Constants.BANK_LOGO_PATH + src.Logo));
                var banks = Mapper.Map <List <GetBanks_Result>, List <BanksViewModel> >(dbBanks);

                return(banks.OrderBy(x => x.Name).ToList());
            }
            catch (Exception ex)
            {
                _logger.Debug("[BankRepository.GetBanks] " + ex.Message);
                return(new List <BanksViewModel>());
            }
        }
예제 #2
0
        public BankViewModel GetBank(BankForm form)
        {
            try
            {
                //Get bank info
                var cityIdStr = form.CityId.ToString(CultureInfo.InvariantCulture);
                var bank      = _db.Bank.Where(x => x.CitiesIds.Contains(cityIdStr) && x.ShortName == form.Bank)
                                .Select(y => new BankViewModel {
                    Name = y.Name, Logo = Constants.BANK_LOGO_PATH + y.Logo_big, Website = y.Website
                }).SingleOrDefault();

                if (bank == null)
                {
                    return(new BankViewModel());
                }

                //Add rates
                var bankRatesDb = _db.GetBankRates(form.Bank, form.CityId).ToList();
                Mapper.CreateMap <GetBankRates_Result, CurrencyModel>();
                bank.Rates = Mapper.Map <List <GetBankRates_Result>, List <CurrencyModel> >(bankRatesDb);

                //Add adresses of departments in the city
                bank.Addresses = _db.Address.Where(x => x.Bank == form.Bank && x.CityId == form.CityId)
                                 .Select(y => new AddressModel {
                    Address = y.Address1, Latitude = y.Latitude, Longitude = y.Longitude
                })
                                 .ToList();

                return(bank);
            }
            catch (Exception ex)
            {
                _logger.Debug("[BankRepository.GetBank] " + ex.Message);
                return(new BankViewModel());
            }
        }
예제 #3
0
        public BankViewModel GetBank(BankForm form)
        {
            var bank = _bankRepository.GetBank(form);

            return(bank);
        }
예제 #4
0
        public ActionResult GetBank(BankForm form)
        {
            var bank = _bankService.GetBank(form);

            return(Json(bank));
        }
예제 #5
0
        public List <BanksViewModel> GetBanks(BankForm form)
        {
            var allBanks = _bankRepository.GetBanks(form);

            return(allBanks);
        }