public async Task <IHttpActionResult> Post(Comment comment) { try { if (ModelState.IsValid) { _repo.AddComment(comment); if (await _repo.SaveChangesAsync()) { return(Created("GetComments", new { commentId = comment.CommentId })); } } } catch (Exception ex) { return(BadRequest(ex.Message)); } return(BadRequest()); }