public HttpResponseMessage Get(int id) { if (id > 0) { var address = _addressServices.GetAddressById(id); if (address != null) { return(Request.CreateResponse(HttpStatusCode.OK, address)); } throw new ApiDataException(1001, "No product found for this id.", HttpStatusCode.NotFound); } throw new ApiException() { ErrorCode = (int)HttpStatusCode.BadRequest, ErrorDescription = "Bad Request..." }; }