public void Add(ABTest.ABRuleSetting item) { if (null != item) { UpdateOrAdd(item, item); } }
public ABTest.ABRuleSetting Get(ABTest.ABRuleSetting dummy) { var temp = _dbContext.ABRuleSettings.Where(it => it.UUID.Equals(dummy.UUID, StringComparison.OrdinalIgnoreCase)); if (null != dummy.Site) { temp = temp.Where(it => it.SiteName.Equals(dummy.Site.FullName, StringComparison.OrdinalIgnoreCase)); } else { temp = temp.Where(it => String.IsNullOrEmpty(it.SiteName)); } var result = temp.ToList() .Select(it => it.ToABRuleSetting()) .FirstOrDefault(); return(result); }
public void Remove(ABTest.ABRuleSetting item) { ((IPersistable)item).OnSaving(); var dummy = _dbContext.ABRuleSettings.Where(it => it.UUID.Equals(item.UUID, StringComparison.OrdinalIgnoreCase)); if (null != item.Site) { dummy = dummy.Where(it => it.SiteName.Equals(item.Site.FullName, StringComparison.OrdinalIgnoreCase)); } else { dummy = dummy.Where(it => String.IsNullOrEmpty(it.SiteName)); } var temp = dummy.FirstOrDefault(); if (null != temp) { _dbContext.ABRuleSettings.Remove(temp); _dbContext.SaveChanges(); } ((IPersistable)item).OnSaved(); }
public void Update(ABTest.ABRuleSetting @new, ABTest.ABRuleSetting old) { UpdateOrAdd(@new, old); }