コード例 #1
0
        public async Task <object> Post(int exId, [FromBody] ExchangeReplyViewModel model)
        {
            MessageBase2 result = new MessageBase2();

            ExchangeReplyDto dto = new ExchangeReplyDto()
            {
                ExId     = exId,
                UserId   = model.UserId,
                Text     = model.Text,
                ParentId = model.ParentId
            };
            await _exchangeReplyService.AddAsync(dto);


            return(result);
        }
コード例 #2
0
        /// <summary>
        /// 添加评论
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        public async Task <bool> AddAsync(ExchangeReplyDto dto)
        {
            var model = new ExchangeReply()
            {
                ExId     = dto.ExId,
                UserId   = dto.UserId,
                Text     = dto.Text,
                ParentId = dto.ParentId,
                LikeNum  = 0,
                LikeUser = "",
                AddTime  = DateTime.Now,
                Status   = 1
            };

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

            return(model.Id > 0);
        }