public async Task <ActionResult> MerchantsSettingsPage()
        {
            var model = new MerchantSettingsListViewModel();

            model.Merchants = await _payMerchantClient.Api.GetAllAsync();

            model.CurrentPage  = 1;
            model.IsFullAccess = (this.GetUserRolesPair()).HasAccessToFeature(UserFeatureAccess.LykkePayMerchantsFull);
            return(View(model));
        }
        public async Task <ActionResult> MerchantsSettingsList(MerchantSettingsListViewModel vm)
        {
            MerchantSetting setting;

            try
            {
                setting = await _payInvoiceClient.GetMerchantSettingAsync(vm.SelectedMerchant);
            }
            catch (Lykke.Service.PayInvoice.Client.ErrorResponseException ex) when(ex.StatusCode ==
                                                                                   HttpStatusCode.NotFound)
            {
                setting = null;
            }

            vm.PageSize = vm.PageSize == 0 ? 10 : vm.PageSize;
            var pagesize = Request.Cookies["PageSize"];

            if (pagesize != null)
            {
                vm.PageSize = Convert.ToInt32(pagesize);
            }
            var list = new List <MerchantSetting>();

            if (setting != null)
            {
                list.Add(setting);
            }
            var pagedlist   = new List <MerchantSetting>();
            var pageCount   = Convert.ToInt32(Math.Ceiling((double)list.Count() / vm.PageSize));
            var currentPage = vm.CurrentPage == 0 ? 1 : vm.CurrentPage;

            if (list.Count() != 0)
            {
                pagedlist = list.AsQueryable().ToPagedList(currentPage, vm.PageSize).ToList();
            }
            var viewmodel = new MerchantSettingsListViewModel()
            {
                Settings     = pagedlist,
                PageSize     = vm.PageSize,
                Count        = pageCount,
                CurrentPage  = currentPage,
                IsEditAccess = (this.GetUserRolesPair()).HasAccessToFeature(UserFeatureAccess.LykkePayMerchantsEdit),
                IsFullAccess = (this.GetUserRolesPair()).HasAccessToFeature(UserFeatureAccess.LykkePayMerchantsFull)
            };

            return(View(viewmodel));
        }