Example #1
0
        protected override KeepKnowledgeRD ProcessRequest(DTO.Base.APIRequest <KeepKnowledgeRP> pRequest)
        {
            KeepKnowledgeRD rd   = new KeepKnowledgeRD();
            var             para = pRequest.Parameters;

            #region 文章的收藏数据+1
            var bll    = new KnowledgeBLL(CurrentUserInfo);
            var entity = bll.GetByID(para.ID);
            entity.KeepCount++;
            bll.Update(entity);
            #endregion

            #region 往文章的收藏表插入一条记录。
            var keepbll    = new KnowledgeKeepBLL(CurrentUserInfo);
            var keepEntity = new KnowledgeKeepEntity()
            {
                VipId       = CurrentUserInfo.UserID,
                KnowIedgeId = para.ID
            };
            var temp = keepbll.QueryByEntity(keepEntity, null);
            if (temp.Length == 0)
            {
                keepEntity.KnowledgeKeepId = Guid.NewGuid();
                keepbll.Create(keepEntity);
            }
            #endregion
            return(rd);
        }
        protected override TreadKnowledgeRD ProcessRequest(DTO.Base.APIRequest <TreadKnowledgeRP> pRequest)
        {
            TreadKnowledgeRD rd = new TreadKnowledgeRD();
            var para            = pRequest.Parameters;

            #region 文章的踩数+1

            var bll    = new KnowledgeBLL(CurrentUserInfo);
            var entity = bll.GetByID(para.ID);
            entity.TreadCount++;
            bll.Update(entity);

            #endregion

            #region 往文章的踩表插入一条记录
            var treadbll    = new KnowledgeTreadBLL(CurrentUserInfo);
            var treadEntity = new KnowledgeTreadEntity()
            {
                VipId       = CurrentUserInfo.UserID,
                KnowIedgeId = para.ID
            };
            var temp = treadbll.QueryByEntity(treadEntity, null);
            if (temp.Length == 0)
            {
                treadEntity.TreadId = Guid.NewGuid();
                treadbll.Create(treadEntity);
            }

            #endregion
            return(rd);
        }
        protected override PraiseKnowledgeRD ProcessRequest(DTO.Base.APIRequest <PraiseKnowledgeRP> pRequest)
        {
            PraiseKnowledgeRD rd = new PraiseKnowledgeRD();
            var para             = pRequest.Parameters;

            #region 更新文章 赞的数量
            var bll    = new KnowledgeBLL(CurrentUserInfo);
            var entity = bll.GetByID(para.ID);
            entity.PraiseCount++;
            bll.Update(entity);
            #endregion

            #region 往文章赞表中插入一条记录
            var praisebll    = new KnowledgePraiseBLL(CurrentUserInfo);
            var praiseEntity = new KnowledgePraiseEntity()
            {
                PraiseId    = Guid.NewGuid(),
                VipId       = CurrentUserInfo.UserID,
                KnowIedgeId = para.ID
            };
            praisebll.Create(praiseEntity);
            #endregion
            return(rd);
        }