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; }
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; }
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; }
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)); }
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)); }
public PinnedSearchResultsFactory(IItemSearch itemSearch, ILogService log) { _itemSearch = itemSearch; _log = log; }