public void TopShow(TopShow entity) { if (!IsExist(entity)) { using (var content = new FxAggregateContext()) { content.TopShows.Add(entity); content.SaveChanges(); } } }
/// <summary> /// 取消置顶 /// </summary> /// <param name="entity"></param> public void TopShowCancel(TopShow entity) { if (IsExist(entity)) { using (var content = new FxAggregateContext()) { entity = content.TopShows .Where(r => r.TopShowId == entity.TopShowId) .FirstOrDefault(); if (entity != null) { content.TopShows.Remove(entity); content.SaveChanges(); } } } }
public bool IsExist(TopShow entity) { return GetById(entity.TopShowId) != null; }