Exemple #1
0
        public static void InsertProductReports(ICollection <ProductReport> productReports)
        {
            using (ProductReportsEntities sqLiteContext = new ProductReportsEntities())
            {
                foreach (var productReport in productReports)
                {
                    SupermarketSQLite.Model.ProductReport report = new SupermarketSQLite.Model.ProductReport()
                    {
                        ProductId         = productReport.ProductId,
                        ProductName       = productReport.ProductName,
                        TotalIncomes      = productReport.TotalIncomes,
                        TotalQuantitySold = productReport.TotalQuantitySold,
                        VendorName        = productReport.VendorName
                    };

                    sqLiteContext.ProductReports.Add(report);
                }
                sqLiteContext.SaveChanges();
            }
        }
        public static void InsertProductReports(ICollection<ProductReport> productReports)
        {
            using (ProductReportsEntities sqLiteContext = new ProductReportsEntities())
            {
                foreach (var productReport in productReports)
                {
                    SupermarketSQLite.Model.ProductReport report = new SupermarketSQLite.Model.ProductReport()
                    {
                        ProductId = productReport.ProductId,
                        ProductName = productReport.ProductName,
                        TotalIncomes = productReport.TotalIncomes,
                        TotalQuantitySold = productReport.TotalQuantitySold,
                        VendorName = productReport.VendorName
                    };

                    sqLiteContext.ProductReports.Add(report);
                }
                sqLiteContext.SaveChanges();
            }
        }