Exemple #1
0
        private void InsertOrUpdate(Models.Page @new, Models.Page old)
        {
            @new.OnSaving();

            DataHelper.StoreObject(@new, @new.UUID, ModelExtensions.PageDataType);

            @new.OnSaved();
        }
Exemple #2
0
        private void InsertOrUpdate(Models.Page @new, Models.Page old)
        {
            @new.OnSaving();

            var entity         = PageEntityHelper.ToPageEntity(@new);
            var serviceContext = CloudTableHelper.GetTableServiceContext();

            if (Get(old) == null)
            {
                serviceContext.AddObject(PageTable, entity);
            }
            else
            {
                serviceContext.AttachTo(PageTable, entity, "*");
                serviceContext.UpdateObject(entity);
            }
            serviceContext.SaveChangesWithRetries();
        }
Exemple #3
0
        private void InsertOrUpdate(Models.Page @new, Models.Page old)
        {
            @new.OnSaving();

            var entity = _dbContext.Pages
                         .Where(it => it.SiteName == old.Site.FullName && it.FullName == old.FullName)
                         .FirstOrDefault();

            if (entity != null)
            {
                PageEntityHelper.ToPageEntity(@new, entity);
            }
            else
            {
                _dbContext.Pages.Add(PageEntityHelper.ToPageEntity <PageEntity>(@new));
            }
            _dbContext.SaveChanges();
            ClearCache();
        }