Пример #1
0
        public coreModel.Store Create(coreModel.Store store)
        {
            var dbStore = store.ToDataModel();

            using (var repository = _repositoryFactory())
            {
                repository.Add(dbStore);
                CommitChanges(repository);
            }

            //Need add seo separately
            if (store.SeoInfos != null)
            {
                foreach (var seoInfo in store.SeoInfos)
                {
                    seoInfo.ObjectId   = dbStore.Id;
                    seoInfo.ObjectType = typeof(coreModel.Store).Name;
                    _commerceService.UpsertSeo(seoInfo);
                }
            }

            //Deep save settings
            SaveObjectSettings(_settingManager, store);

            var retVal = GetById(store.Id);

            return(retVal);
        }
Пример #2
0
        public coreModel.Store Create(coreModel.Store store)
        {
            var dbStore = store.ToDataModel();

            using (var repository = _repositoryFactory())
            {
                repository.Add(dbStore);
                CommitChanges(repository);
                store.Id = dbStore.Id;
            }

            //Need add seo separately
            _commerceService.UpsertSeoForObjects(new[] { store });

            //Deep save properties
            _dynamicPropertyService.SaveDynamicPropertyValues(store);
            //Deep save settings
            _settingManager.SaveEntitySettingsValues(store);

            //Invalidate module cache region
            _cacheManager.ClearRegion("StoreModuleRegion");

            var retVal = GetById(store.Id);

            return(retVal);
        }
Пример #3
0
        public coreModel.Store Create(coreModel.Store store)
        {
            var dbStore = store.ToDataModel();

            using (var repository = _repositoryFactory())
            {
                repository.Add(dbStore);
                CommitChanges(repository);
            }

            //Need add seo separately
            if (store.SeoInfos != null)
            {
                foreach (var seoInfo in store.SeoInfos)
                {
                    seoInfo.ObjectId   = dbStore.Id;
                    seoInfo.ObjectType = typeof(coreModel.Store).Name;
                    _commerceService.UpsertSeo(seoInfo);
                }
            }

            //Deep save properties
            _dynamicPropertyService.SaveDynamicPropertyValues(store);
            //Deep save settings
            _settingManager.SaveEntitySettingsValues(store);

            //Reset cache
            var cacheKey = CacheKey.Create("StoreModule", "GetById", store.Id);

            _cacheManager.Remove(cacheKey);

            var retVal = GetById(store.Id);

            return(retVal);
        }