public IActionResult GetCount( [FromServices] GetProducts getProducts) { int count = getProducts.GetProductsCount().Result; return(Ok(count)); }
public IActionResult GetCountBuCategoryId( Guid?categoryId, [FromServices] GetProducts getProducts) { int count = getProducts.GetProductsCount(categoryId).Result; return(Ok(count)); }
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); }
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); }
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); }