Beispiel #1
0
        public HttpResponseMessage GetById(int id)
        {
            try
            {
                var obj = _applicationBase.Get(_ => _.Id == id);

                if (obj == null)
                {
                    return(Request.CreateResponse(HttpStatusCode.NotFound));
                }
                else
                {
                    return(Request.CreateResponse(HttpStatusCode.OK, obj));
                }
            }
            catch (Exception e)
            {
                return(Request.CreateResponse(HttpStatusCode.InternalServerError, e.Message));
            }
        }