//Only use available DI service for IWebHostEnvironment public StockController(IWebHostEnvironment webHostEnvironment) { rootPath = Path.Combine(webHostEnvironment.WebRootPath, folder); inList = LocalDataAccess.ReadDataStockIn(rootPath, stockInFile); outList = LocalDataAccess.ReadDataStockOut(rootPath, stockOutFile); products = LocalDataAccess.ReadDataProduct(rootPath, productFile); }
public MockProductRepository(IWebHostEnvironment webHostingEnvironment) { this.webHostingEnvironment = webHostingEnvironment; string rootPath = Path.Combine(this.webHostingEnvironment.WebRootPath, folder); products = LocalDataAccess.ReadDataProduct(rootPath, productFile); productTypes = LocalDataAccess.ReadDataProductType(rootPath, typeFile); }