public List <ShopItemModel> Execute(int categoryId)
 {
     return(_shopItemRepository.GetAll()
            .Where(c => c.CategoryId == categoryId)
            .Select(s => _mapper.Map <ShopItemModel>(s))
            .ToList());
 }
        public List <ShopItemModel> Execute()
        {
            var shopItems      = _shopItemRepository.GetAll();
            var shopItemModels = shopItems.Select(s => _mapper.Map <ShopItemModel>(s));

            return(shopItemModels.ToList());
        }
Exemple #3
0
        public IActionResult List(int?pageNumber)
        {
            int pageSize = 1;

            var model = _repo.GetAll().Select(p =>
                                              new ShopItemListVM
            {
                ID          = p.ID,
                Name        = p.Name,
                Price       = p.Price,
                Quantity    = p.Quantity,
                Description = p.Description
            }).AsQueryable();

            var newModel = PaginatedList <ShopItemListVM> .CreateAsync(model, pageNumber ?? 1, pageSize);

            return(View("List", newModel));
        }