public IHttpActionResult Post([FromBody] FirmComment firmcomment) { try { if (firmcomment == null) { return(BadRequest()); } firmcomment.DateCreated = DateTime.Now; var result = _repository.Insert(firmcomment); if (result.Status == RepositoryActionStatus.Created) { // map to dto return(Created <FirmComment>(Request.RequestUri + "/" + firmcomment.Id.ToString(), firmcomment)); } return(BadRequest()); } catch (Exception) { return(InternalServerError()); } }