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