private void AddCatalogItems(CatalogDBContext context)
        {
            var preconfiguredItems = useCustomizationData
                ? GetCatalogItemsFromFile(context)
                : PreconfiguredData.GetPreconfiguredCatalogItems();

            foreach (var item in preconfiguredItems)
            {
                var sequenceId = indexGenerator.GetNextSequenceValue(context);
                item.Id = sequenceId;
                context.CatalogItems.Add(item);
            }

            context.SaveChanges();
        }
Пример #2
0
 public void CreateCatalogItem(CatalogItem catalogItem)
 {
     catalogItem.Id = indexGenerator.GetNextSequenceValue(db);
     db.CatalogItems.Add(catalogItem);
     db.SaveChanges();
 }