public virtual void Initialize() { _productExtensionService = new ProductExtensionService(context); _productService = new ProductService(context, _productExtensionService); _transactionScope = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled); var fakeProducts = new List <Product>() { new Product() { Name = "Product 1", DisplayOnFrontPage = true, DoNotDisplay = false }, new Product() { Name = "Product 2", DisplayOnFrontPage = true, DoNotDisplay = false }, new Product() { Name = "Product 3", DisplayOnFrontPage = false, DoNotDisplay = false }, new Product() { Name = "Product 4", DisplayOnFrontPage = false, DoNotDisplay = false }, new Product() { Name = "Product 5", DisplayOnFrontPage = false, DoNotDisplay = true } }; context.Products.AddRange(fakeProducts); context.SaveChanges(); var fakeProductExtensions = new List <ProductExtension>() { new ProductExtension() { Diameter = 6, ProductId = fakeProducts[0].Id }, new ProductExtension() { Diameter = 6, ProductId = fakeProducts[1].Id }, new ProductExtension() { Diameter = 9, ProductId = fakeProducts[2].Id }, new ProductExtension() { Diameter = 12, ProductId = fakeProducts[3].Id }, new ProductExtension() { Diameter = 15, ProductId = fakeProducts[4].Id } }; context.ProductExtensions.AddRange(fakeProductExtensions); context.SaveChanges(); }
public BaseController() { // Set storage service for product images _storageService = new FileSystemService(_contentFolder); _productImageManager = new ImageManager(_productImagesFolder, _storageService); _context = new ApplicationDbContext(); var productExtensionService = new ProductExtensionService(_context); _productService = new ProductService(_context, productExtensionService); }