private void InsertOrUpdate(Models.Page @new, Models.Page old) { @new.OnSaving(); DataHelper.StoreObject(@new, @new.UUID, ModelExtensions.PageDataType); @new.OnSaved(); }
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(); }
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(); }