internal static void Initialize(HandlePriceDetailsDbContext context)
        {
            // Check if our database is created if not then create it
            context.Database.EnsureCreated();

            if (!context.Products.Any())
            {
                context.Products.AddRange(ConvertService.CsvToProductList("price_detail.csv"));

                context.SaveChanges();
            }
        }
Example #2
0
 public Product Create(Product product)
 {
     _handlePriceDetailsDbContext.Products.Add(product);
     _handlePriceDetailsDbContext.SaveChanges();
     return(product);
 }