public DataTable CreateDataTable(StoreModel store, DocumentModel document, int fromDocument, int toDocument, int emptySpace) { DataTable dt = new DataTable("Products"); dt.Columns.Add("Id"); dt.Columns.Add("Name"); dt.Columns.Add("Unit"); dt.Columns.Add("Supplier"); dt.Columns.Add("Manufacturer"); dt.Columns.Add("ExpiryDay"); dt.Columns.Add("ManufacturerCountry"); dt.Columns.Add("WholesalePrice"); dt.Columns.Add("RetailPrice"); List <ProductModel> products = _productRepository.GetProducts(document, fromDocument, toDocument, store.StoreId); for (int i = 0; i < Convert.ToInt32(emptySpace); i++) { dt.Rows.Add(new Object[] { null, null, null, null, null, null, null, null }); } SetProductsInDataTable(products, ref dt); return(dt); }