Beispiel #1
0
        public async Task <object> Post(int coId, [FromBody] CooperationReplyViewModel model)
        {
            MessageBase2 result = new MessageBase2();

            CooperationReplyDto dto = new CooperationReplyDto()
            {
                CoId     = coId,
                UserId   = model.UserId,
                Text     = model.Text,
                ParentId = model.ParentId
            };
            await _cooperationReplyService.AddAsync(dto);


            return(result);
        }
        /// <summary>
        /// 添加评论
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        public async Task <bool> AddAsync(CooperationReplyDto dto)
        {
            var model = new CooperationReply()
            {
                CoId     = dto.CoId,
                UserId   = dto.UserId,
                Text     = dto.Text,
                ParentId = dto.ParentId,
                LikeNum  = 0,
                LikeUser = "",
                AddTime  = DateTime.Now,
                Status   = 1
            };

            model = await this.CooperationReplyRepository.AddAsync(model);

            return(model.Id > 0);
        }