public IHttpActionResult GetById(int id) { try { var invoice = _invoices.GetById(id); if (invoice == null) { return(NotFound()); } return(Ok(invoice)); } catch (Exception ex) { return(BadRequest(ex.Message)); } }