コード例 #1
0
 public void Add(ABPageSetting item)
 {
     if (null != item)
     {
         UpdateOrAdd(item, item);
     }
 }
コード例 #2
0
 public ABPageSetting Get(ABPageSetting dummy)
 {
     return _dbContext.ABPageSettings.Where(it => it.UUID.Equals(dummy.UUID, StringComparison.OrdinalIgnoreCase) && it.SiteName.Equals(dummy.Site.FullName, StringComparison.OrdinalIgnoreCase))
         .ToList()
         .Select(it => it.ToABPageSetting()).FirstOrDefault();
 }
コード例 #3
0
 public void Update(ABPageSetting @new, ABPageSetting old)
 {
     UpdateOrAdd(@new, old);
 }
コード例 #4
0
 private void UpdateOrAdd(ABPageSetting item, ABPageSetting oldItem)
 {
     ((IPersistable)item).OnSaving();
     var dummy = _dbContext.ABPageSettings.FirstOrDefault(it => it.UUID.Equals(oldItem.UUID, StringComparison.OrdinalIgnoreCase)
         && it.SiteName.Equals(oldItem.Site.FullName, StringComparison.OrdinalIgnoreCase));
     if (null != dummy)
     {
         item.ToABPageSettingEntity<ABPageSettingEntity>(dummy);
     }
     else
     {
         dummy = item.ToABPageSettingEntity<ABPageSettingEntity>();
         _dbContext.ABPageSettings.Add(dummy);
     }
     _dbContext.SaveChanges();
     ((IPersistable)item).OnSaved();
 }
コード例 #5
0
 public void Remove(ABPageSetting item)
 {
     ((IPersistable)item).OnSaving();
     var dummy = _dbContext.ABPageSettings.FirstOrDefault(it => it.UUID.Equals(item.UUID, StringComparison.OrdinalIgnoreCase) && it.SiteName.Equals(item.Site.FullName, StringComparison.OrdinalIgnoreCase));
     if (null != dummy)
     {
         _dbContext.ABPageSettings.Remove(dummy);
         _dbContext.SaveChanges();
     }
     ((IPersistable)item).OnSaved();
 }