private void SetupGeocaches() { this.geocacheList = new List <GeocacheModel>(); this.geocache = new GeocacheModel { Id = 4, Name = "Name" }; this.geocacheList.Add(this.geocache); }
// GET api/geocache/5 public HttpResponseMessage Get(long id) { try { var foundCache = _repository.GetGeocacheByID(id); if(foundCache != null) { var foundCacheModel = new GeocacheModel(foundCache); return Request.CreateResponse(HttpStatusCode.OK, foundCacheModel); } else { return Request.CreateResponse(HttpStatusCode.NotFound); } } catch(Exception ex) { return Request.CreateResponse(HttpStatusCode.BadRequest, ex); } }