// GET api/<controller> public HttpResponseMessage Get(HttpRequestMessage request) { var useremail = new TApiAuth().GetLoggedInUsername(Request); if (string.IsNullOrEmpty(useremail)) { return(new HttpResponseMessage(HttpStatusCode.BadRequest)); } var locations = _locationManager.GetAllLocations().Where(x => (x.enabled.HasValue && x.enabled.Value)); HttpResponseMessage response = request.CreateResponse <IEnumerable <Location> >(HttpStatusCode.OK, locations); return(response); }