public HttpResponseMessage Get(int id) { ItemResponse <ErrorLog> response = new ItemResponse <ErrorLog>(); ErrorLog eLog = _errorLogService.Get(id); if (eLog.Id == 0) { string error = "No ErrorLog exists for supplied id"; return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, error)); } response.Item = _errorLogService.Get(id); return(Request.CreateResponse(HttpStatusCode.OK, response)); }
public HttpResponseMessage Get(int id) { try { ItemResponse <ErrorLog> resp = new ItemResponse <ErrorLog>(); resp.Item = _errorService.Get(id); return(Request.CreateResponse(HttpStatusCode.OK, resp)); } catch (Exception ex) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex)); } }