Example #1
0
        public string AddReply(Reply reply)
        {
            var mapper = Common.GetMapper();

            ReplyDao  replydao  = new ReplyDao(mapper);
            TopicDao  topicdao  = new TopicDao(mapper);
            NotifyDao notifydao = new NotifyDao(mapper);

            topicdao.UpdateReplyCount(new TopicQueryForm
            {
                ID            = reply.TopicID,
                LastReplierID = reply.OwnerID,
            });
            topicdao.Update(new TopicUpdateForm
            {
                QueryForm = new TopicQueryForm {
                    ID = reply.TopicID
                },
                Entity = new Topic {
                    LastReplierID = reply.OwnerID
                }
            });
            replydao.Add(reply);
            notifydao.Add(new Notify
            {
                TopicID = reply.TopicID,
                UserID  = reply.ReplyToID,
                ReplyID = reply.ID,
            });

            return(reply.ID);
        }