コード例 #1
0
        public ViewResult Index(int page = 1, FilterBy filter = FilterBy.NoFilter, string substring = null)
        {
            ViewBag.substring = substring;
            ViewBag.filter    = filter;
            var characters = repository.Characters
                             .Where(FilterModels.Filters[filter])
                             .ToArray();

            if (!string.IsNullOrEmpty(substring))
            {
                characters = characters.Where(c => c.Name.Contains(substring)).ToArray();
            }
            var charterersOnPage = characters
                                   .Skip((page - 1) * PageSize)
                                   .Take(PageSize)
                                   .Select(c => new CharacterViewModel {
                Character = c,
                VoteType  = CartHelpers.GetVoteTypeForCharacter(c, cartProvider.GetCart(this))
            })
                                   .ToArray();
            CharactersListViewModel model = new CharactersListViewModel
            {
                Characters = charterersOnPage,
                PagingInfo = new PagingInfo
                {
                    CurrentPage  = page,
                    ItemsPerPage = PageSize,
                    TotalItems   = characters.Length
                }
            };

            return(View(model));
        }
コード例 #2
0
    public NVPAPICaller(IConfiguration config, HttpContext httpContext)
    {
        _config      = config;
        _httpContext = httpContext;

        cartId       = new CartHelpers().GetCartId(_httpContext);
        pEndPointURL = _config["APIEndpoints:PaymentsAPI"];
    }
コード例 #3
0
    public NVPAPICaller(IConfiguration config, HttpContext httpContext)
    {
        _config      = config;
        _httpContext = httpContext;

        cartId       = new CartHelpers().GetCartId(_httpContext);
        pEndPointURL = _config.GetValue <string>("paymentsAPIUrl");
    }