Esempio n. 1
0
        public IHttpActionResult GetEvent([FromUri] int id)
        {
            Exception      ex     = null;
            EventViewModel result = null;

            try {
                var e = _dataProvider.GetEntity <Event>(id);
                result = new EventViewModel(e);

                result.AddLink(new Link(Request.RequestUri, HttpMethod.Get, RelValues.Self, ActionValues.Refresh, "Events/" + id));
                result.AddLink(new Link(Request.RequestUri, HttpMethod.Put, RelValues.Self, ActionValues.Save, "Events/" + id));
                result.AddLink(new Link(Request.RequestUri, HttpMethod.Delete, RelValues.Self, ActionValues.Delete, "Events/" + id));
            } catch (Exception e) {
                ex = e;
            }

            return(GetHttpActionResult(result, ex));
        }