Beispiel #1
0
 /// <summary>
 /// 添加收藏
 /// </summary>
 /// <param name="favorite"></param>
 /// <returns></returns>
 public DomainResult AddFavorite(Entity.FxAggregate.Favorite favorite)
 {
     using (var context = new FxAggregateContext())
     {
         var fav = GetFavorite(favorite.ChannelCatagroy, favorite.InfoId, favorite.UserAccount);
         if (fav != null)
         {
             return(new DomainResult(false)
             {
                 ResultMsg = "您已对此帖子进行收藏了"
             });
         }
         var info = aggregateInfoService.GetInfoByCatatgroyAndId(favorite.ChannelCatagroy, favorite.InfoId);
         if (info == null || aggregateInfoService.IsValid(info) == false)
         {
             return(new DomainResult(false)
             {
                 ResultMsg = "您不能对此帖子进行收藏(可能已删除或者未发布)"
             });
         }
         else
         {
             context.Favorites.Add(favorite);
             context.SaveChanges();
             return(DomainResult.GetDefault());
         }
     }
 }
 /// <summary>
 /// 添加私信
 /// </summary>
 /// <param name="message"></param>
 public void AddPrivateMessage(PrivateMessage message)
 {
     using (var content = new FxAggregateContext())
     {
         content.PrivateMessages.Add(message);
         content.SaveChanges();
     }
 }
 /// <summary>
 /// 添加私信
 /// </summary>
 /// <param name="message"></param>
 public void AddPrivateMessage(PrivateMessage message)
 {
     using (var content = new FxAggregateContext())
     {
         content.PrivateMessages.Add(message);
         content.SaveChanges();
     }
 }
 public void TopShow(TopShow entity)
 {
     if (!IsExist(entity))
     {
         using (var content = new FxAggregateContext())
         {
             content.TopShows.Add(entity);
             content.SaveChanges();
         }
     }
 }
Beispiel #5
0
 /// <summary>
 /// 置顶相关帖子
 /// </summary>
 /// <param name="entity">置顶信息</param>
 public void TopShow(TopShow entity)
 {
     if (!IsExist(entity))
     {
         using (var content = new FxAggregateContext())
         {
             content.TopShows.Add(entity);
             content.SaveChanges();
         }
     }
 }
 /// <summary>
 /// 删除私信
 /// </summary>
 /// <param name="message"></param>
 public void RemovePrivateMessage(PrivateMessage message)
 {
     using (var content = new FxAggregateContext())
     {
         var entity = content.PrivateMessages
             .Where(r => r.PrivateMessageId == message.PrivateMessageId).FirstOrDefault();
         if (entity != null)
         {
             content.PrivateMessages.Remove(entity);
             content.SaveChanges();
         }
     }
 }
 /// <summary>
 /// 删除私信
 /// </summary>
 /// <param name="message"></param>
 public void RemovePrivateMessage(PrivateMessage message)
 {
     using (var content = new FxAggregateContext())
     {
         var entity = content.PrivateMessages
                      .Where(r => r.PrivateMessageId == message.PrivateMessageId).FirstOrDefault();
         if (entity != null)
         {
             content.PrivateMessages.Remove(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 DomainResult DeleteFavorite(Entity.FxAggregate.Favorite favorite)
 {
     using (var context = new FxAggregateContext())
     {
         favorite = context.Favorites.Where(r => r.FavoriteId == favorite.FavoriteId).FirstOrDefault();
         if (favorite != null)
         {
             context.Favorites.Remove(favorite);
             context.SaveChanges();
             return DomainResult.GetDefault();
         }
         else
         {
             return new DomainResult(false) { ResultMsg = "收藏失败,此帖子可能已被删除" };
         }
     }
 }
Beispiel #10
0
 /// <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();
             }
         }
     }
 }
Beispiel #11
0
 /// <summary>
 /// 删除收藏
 /// </summary>
 /// <param name="favorite"></param>
 /// <returns></returns>
 public DomainResult DeleteFavorite(Entity.FxAggregate.Favorite favorite)
 {
     using (var context = new FxAggregateContext())
     {
         favorite = context.Favorites.Where(r => r.FavoriteId == favorite.FavoriteId).FirstOrDefault();
         if (favorite != null)
         {
             context.Favorites.Remove(favorite);
             context.SaveChanges();
             return(DomainResult.GetDefault());
         }
         else
         {
             return(new DomainResult(false)
             {
                 ResultMsg = "收藏失败,此帖子可能已被删除"
             });
         }
     }
 }
        public DomainResult AddFavorite(Entity.FxAggregate.Favorite favorite)
        {

            using (var context = new FxAggregateContext())
            {
                var fav = GetFavorite(favorite.ChannelCatagroy, favorite.InfoId, favorite.UserAccount);
                if (fav != null)
                {
                    return new DomainResult(false) { ResultMsg = "您已对此帖子进行收藏了" };
                }
                var info = aggregateInfoService.GetInfoByCatatgroyAndId(favorite.ChannelCatagroy, favorite.InfoId);
                if (info == null || aggregateInfoService.IsValid(info) == false)
                {
                    return new DomainResult(false) { ResultMsg = "您不能对此帖子进行收藏(可能已删除或者未发布)" };
                }
                else
                {
                    context.Favorites.Add(favorite);
                    context.SaveChanges();
                    return DomainResult.GetDefault();
                }
            }
        }