Esempio n. 1
0
        public async Task <Result> UpdateDiscuss(discuss myDiscuss)
        {
            var data = await _discussBll.GetEntities(u => u.id == myDiscuss.id).FirstOrDefaultAsync();

            data.title = myDiscuss.title;
            data.type  = myDiscuss.type;
            _discussBll.Update(data);
            return(Result.Success());
        }
Esempio n. 2
0
        public async Task <Result> AddComment(comment myComment, int discussId)
        {
            if (discussId == 0)
            {
                return(Result.Error());
            }
            myComment.time = DateTime.Now;
            myComment.user = await _userBll.GetEntities(u => u.id == _user.id).FirstOrDefaultAsync();

            var discussData = await _discussBll.GetEntities(u => u.id == discussId).Include(u => u.comments).FirstOrDefaultAsync();

            discussData.comments.Add(myComment);

            _discussBll.Update(discussData);

            //注意,这里经验可以从redis中获取,现在先设置一个1定值
            int level = await _user_extraBll.UpdateExperience(myComment.user.id, 1, false);

            return(Result.Success().SetData(new { level }));
        }