public ProductsListViewModel GetProductsListViewModel(string productName, int page, int pageSize)
        {
            ProductsListViewModel model = new ProductsListViewModel
            {
                Products   = productOperations.GetProducts(page: page, pageSize: pageSize, productName: productName),
                PagingInfo = new PagingInfoViewModel
                {
                    CurrentPage  = page,
                    TotalItems   = productRepository.GetAllProducts().Count(),
                    ItemsPerPage = pageSize
                }
            };

            return(model);
        }
Exemple #2
0
        public ProductsListViewModel GetProductsListViewModel(string type, string productName, int page, int pageSize)
        {
            ProductsListViewModel model = new ProductsListViewModel
            {
                Products   = productOperations.GetProducts(page, pageSize, type, productName),
                PagingInfo = new PagingInfoViewModel
                {
                    CurrentPage = page,
                    TotalItems  = type == null
                    ? productRepository.GetAllProducts().Count()
                    : productRepository.GetAllProducts().Where(p => p.Type == type).Count(),
                    ItemsPerPage = pageSize
                },
                Type = type
            };

            return(model);
        }
Exemple #3
0
 void getProducts()
 {
     dataGridViewProducts.DataSource = productOperations.GetProducts();
 }