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

            newTopic.ComputerId = computerid;
            newTopic.UserName   = User.Identity.Name;

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