コード例 #1
0
 public ProductCategoryAPIController(IProductCategoryService _categoryService, IAscending _ascending, ICount _count, IPageNumber _number, ISize _size, IItemSearch _itemSearch)
 {
     this.categoryService = _categoryService;
     this.ascending       = _ascending;
     this.count           = _count;
     this.number          = _number;
     this.size            = _size;
     this.itemSearch      = _itemSearch;
 }
コード例 #2
0
 public ProductCategoryRepository(IRepository <ProductCategoryEntity> repository, IAscending _ascending, ICount _count, IPageNumber _number, ISize _size, IItemSearch _itemSearch)
 {
     this.Repository = repository;
     this.ascending  = _ascending;
     this.count      = _count;
     this.number     = _number;
     this.size       = _size;
     this.itemSearch = _itemSearch;
 }
コード例 #3
0
 public ProductController(IProductService _service, IRepository <ProductCategoryEntity> _categoryRepository, IAscending _ascending, ICount _count, IPageNumber _number, ISize _size, IItemSearch _itemSearch)
 {
     this.service            = _service;
     this.categoryRepository = _categoryRepository;
     this.ascending          = _ascending;
     this.count      = _count;
     this.number     = _number;
     this.size       = _size;
     this.itemSearch = _itemSearch;
 }
コード例 #4
0
ファイル: ProductRepository.cs プロジェクト: MiroKoLe/Mono
        public async Task <IPagedList <IProduct> > GetProductsAsync(IAscending ascending, ICount count, IPageNumber number, ISize size, IItemSearch itemSearch)
        {
            var productTable = repository.GetProducts();

            productTable = ascending.IsAscending == false?productTable.OrderByDescending(x => x.Name) : productTable.OrderBy(x => x.Name);

            if (!string.IsNullOrEmpty(itemSearch.Search))
            {
                count.TotalCount = await productTable.Where(x => x.Name == itemSearch.Search).CountAsync();

                productTable = productTable.Where(x => x.Name == itemSearch.Search).Skip((number.pageNumber - 1) * size.PageSize).Take(size.PageSize);
            }
            else
            {
                count.TotalCount = await productTable.CountAsync();

                productTable = productTable.Skip((number.pageNumber - 1) * size.PageSize).Take(size.PageSize);
            }

            var enumerableProduct = productTable.AsQueryable();
            var mappedProduct     = Mapper.Map <IEnumerable <ProductEntity>, IEnumerable <IProduct> >(enumerableProduct);

            return(new StaticPagedList <IProduct>(mappedProduct, number.pageNumber, size.PageSize, count.TotalCount));
        }
コード例 #5
0
 public async Task <IPagedList <IProduct> > GetProductsAsync(IAscending ascending, ICount count, IPageNumber number, ISize size, IItemSearch itemSearch)
 {
     return(await Repository.GetProductsAsync(ascending, count, number, size, itemSearch));
 }