public DiscussionThread Map(ApiModels.Thread thread) { return(new DiscussionThread { Id = thread.Id, Title = thread.Title, Body = thread.Body, Created = thread.Created, CreatedBy = thread.CreatedBy }); }
public async Task <IHttpActionResult> PostThreadAsync(ApiModels.Thread thread) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var discussionThread = mapper.Map(thread); db.DiscussionThreads.Add(discussionThread); await db.SaveChangesAsync(); return(Ok(mapper.Map(discussionThread))); }