Example #1
0
        public async Task <PaginatedResultBase <SellProduct> > GetSellProductItemsByConsumerId(int userId, int consumerId, int pageIndex, int pageSize)
        {
            IQueryable <SellProduct> products = this._context.SellPrducts.Include(p => p.Consumer).Where(p => p.UserId == userId &&
                                                                                                         p.ConsumerId == consumerId && p.IsActive).OrderByDescending(p => p.CreatedDate).AsQueryable();

            return(await PaginatedResultBase <SellProduct> .CreateAsync(products.AsNoTracking(), pageIndex, pageSize));
        }
Example #2
0
        public async Task <PaginatedResultBase <Product> > GetProductItemsByVendorId(int userId, int vendorId, int pageIndex, int pageSize, bool isActive)
        {
            IQueryable <Product> products = this._context.Products.Include(p => p.Category).Include(p => p.Brand).Include(p => p.Vendor).Where(p => p.UserId == userId &&
                                                                                                                                               p.VendorId == vendorId && p.IsActive == isActive)
                                            .OrderByDescending(p => p.CreatedDate).AsQueryable();

            return(await PaginatedResultBase <Product> .CreateAsync(products.AsNoTracking(), pageIndex, pageSize));
        }
Example #3
0
        public async Task <PaginatedResultBase <ProductBrand> > GetBrandTypes(int userId, int pageIndex, int pageSize)
        {
            IQueryable <ProductBrand> categories = null;

            categories = this._context.ProductBrands.Where(p => p.UserId == userId).AsQueryable();

            return(await PaginatedResultBase <ProductBrand> .CreateAsync(categories.AsNoTracking(), pageIndex, pageSize));
        }
Example #4
0
        public async Task <PaginatedResultBase <ProductBrand> > GetSearchBrandTypes(int userId, string searchKey, int pageIndex, int pageSize)
        {
            IQueryable <ProductBrand> categories = null;

            if (!String.IsNullOrWhiteSpace(searchKey))
            {
                categories = this._context.ProductBrands.Where(p => p.UserId == userId && (p.Name.ToLower().Contains(searchKey.ToLower()))).AsQueryable();
            }
            else
            {
                categories = this._context.ProductBrands.Where(p => p.UserId == userId).AsQueryable();
            }

            return(await PaginatedResultBase <ProductBrand> .CreateAsync(categories.AsNoTracking(), pageIndex, pageSize));
        }
Example #5
0
        public async Task <PaginatedResultBase <Vendor> > GetSearchVendors(int userId, string searchKeyword, int pageIndex, int pageSize)
        {
            IQueryable <Vendor> vendors = null;

            if (!String.IsNullOrWhiteSpace(searchKeyword))
            {
                vendors = this._context.Vendors.Where(p => p.UserId == userId &&
                                                      (p.Name.ToLower().Contains(searchKeyword.ToLower()) || p.MobileNumber.ToLower().Contains(searchKeyword.ToLower()))).AsQueryable();
            }
            else
            {
                vendors = this._context.Vendors.Where(p => p.UserId == userId).AsQueryable();
            }

            return(await PaginatedResultBase <Vendor> .CreateAsync(vendors.AsNoTracking(), pageIndex, pageSize));
        }
Example #6
0
        public async Task <PaginatedResultBase <Product> > GetSearchProductItems(int userId, string searchKey, int pageIndex, int pageSize, bool isActive)
        {
            IQueryable <Product> products = null;

            if (!String.IsNullOrWhiteSpace(searchKey))
            {
                products = this._context.Products.Include(p => p.Category).Include(p => p.Brand).Include(p => p.Vendor).Where(p => p.UserId == userId &&
                                                                                                                              (p.Code.Contains(searchKey) || p.Name.Contains(searchKey)) && p.IsActive == isActive)
                           .OrderByDescending(p => p.CreatedDate).AsQueryable();
            }
            else
            {
                products = this._context.Products.Include(p => p.Category).Include(p => p.Brand).Include(p => p.Vendor).Where(p => p.UserId == userId && p.IsActive == isActive).OrderByDescending(p => p.CreatedDate).AsQueryable();
            }

            return(await PaginatedResultBase <Product> .CreateAsync(products.AsNoTracking(), pageIndex, pageSize));
        }
Example #7
0
        public async Task <PaginatedResultBase <SellProduct> > GetSellProducts(int userId, string searchKeyword, int pageIndex, int pageSize)
        {
            IQueryable <SellProduct> products = null;

            if (!String.IsNullOrWhiteSpace(searchKeyword))
            {
                products = this._context.SellPrducts.Include(p => p.Consumer).Where(p => p.UserId == userId &&
                                                                                    (p.Id.ToString().Contains(searchKeyword) || p.Consumer.Name.Contains(searchKeyword) || p.Consumer.MobileNumber.Contains(searchKeyword)) && p.IsActive)
                           .OrderByDescending(p => p.CreatedDate).AsQueryable();
            }
            else
            {
                products = this._context.SellPrducts.Include(p => p.Consumer).Where(p => p.UserId == userId && p.IsActive).OrderByDescending(p => p.CreatedDate).AsQueryable();
            }

            return(await PaginatedResultBase <SellProduct> .CreateAsync(products.AsNoTracking(), pageIndex, pageSize));
        }
Example #8
0
        public async Task <PaginatedResultBase <SellProductHistory> > GetSellProductHistoryById(int saleId, int pageIndex, int pageSize)
        {
            IQueryable <SellProductHistory> productItems = this._context.SellPrductHistory.Include(p => p.Product).Where(p => Property <int>(p, "SellProductId") == saleId && p.IsActive).OrderByDescending(p => p.CreatedDate).AsQueryable();

            return(await PaginatedResultBase <SellProductHistory> .CreateAsync(productItems.AsNoTracking(), pageIndex, pageSize));
        }