Exemple #1
0
        public IActionResult GetCount(
            [FromServices] GetProducts getProducts)
        {
            int count = getProducts.GetProductsCount().Result;

            return(Ok(count));
        }
Exemple #2
0
        public IActionResult GetCountBuCategoryId(
            Guid?categoryId,
            [FromServices] GetProducts getProducts)
        {
            int count = getProducts.GetProductsCount(categoryId).Result;

            return(Ok(count));
        }
Exemple #3
0
        public void OnGet(
            [FromServices] GetProducts getProducts,
            [FromServices] GetCategories getCategories,
            int pageNumber = 1, int pageSize = PageZize)
        {
            IndexViewModel = new IndexViewModel {
                Products   = getProducts.Do(pageNumber, pageSize),
                Categories = getCategories.Do()
            };
            var taskCount = getProducts.GetProductsCount();
            int count     = taskCount.Result;

            PageViewModel = new PageViewModel(count, pageNumber, PageZize);
        }
Exemple #4
0
        public void OnGetSearchProduct(
            [FromServices] GetProducts getProducts,
            [FromServices] GetCategories getCategories,
            string searchString)
        {
            IndexViewModel = new IndexViewModel {
                Products = string.IsNullOrEmpty(searchString)
                                        ? getProducts.Do(1, PageZize)
                                        : getProducts.Do(searchString),
                Categories = getCategories.Do()
            };
            var taskCount = getProducts.GetProductsCount();
            int count     = taskCount.Result;

            PageViewModel = new PageViewModel(count, 1, PageZize);
        }
Exemple #5
0
        public void OnGetByCategoryId(
            [FromServices] GetProducts getProducts,
            [FromServices] GetCategories getCategories,
            string categoryId,
            int pageNumber = 1, int pageSize = PageZize)
        {
            IndexViewModel = new IndexViewModel {
                Products   = getProducts.Do(categoryId, pageNumber, pageSize),
                Categories = getCategories.Do()
            };
            selectedCategoryId = categoryId;
            var taskCount = getProducts.GetProductsCount(selectedCategoryId);
            int count     = taskCount.Result;

            PageViewModel = new PageViewModel(count, pageNumber, PageZize);
        }