예제 #1
0
        public HttpResponseMessage Post(int topicid, [FromBody] Reply newReply)
        {
            if (newReply.Created == default(DateTime))
            {
                newReply.Created = DateTime.UtcNow;
            }

            newReply.TopicId  = topicid;
            newReply.UserName = User.Identity.Name;

            if (_msg.AddReply(newReply) && _msg.Save())
            {
                return(Request.CreateResponse(HttpStatusCode.Created, newReply));
            }
            return(Request.CreateResponse(HttpStatusCode.BadRequest));
        }