// POST api/post public IHttpActionResult Post([FromBody] Post post) { // TODO move authentication related code out if (!Request.Headers.Contains(Constants.UserId)) { return(Unauthorized()); } Post persistentpost = new Post(); post.UserId = Request.Headers.GetValues(Constants.UserId).First(); post.Content = post.Content; post.PostsedAt = DateTime.UtcNow; // persist postlogic.HandleUserPost(post); return(ResponseMessage(new HttpResponseMessage(HttpStatusCode.Created))); }