// GET api/values/5 public AgreementView Get(int id) { try { var item = repository.Get(id); return(new AgreementView() { Id = item.Id, Name = item.Name, Number = item.Number, BegDate = item.BeginDate, EndDate = item.EndDate }); } catch (AggregateException ex) { throw new HttpResponseException(Request.CreateErrorResponse(HttpStatusCode.NotFound, ex.Message)); } }