Esempio n. 1
0
        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);
        }
Esempio n. 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);
        }
Esempio n. 3
0
 void getProducts()
 {
     dataGridViewProducts.DataSource = productOperations.GetProducts();
 }