// GET: api/SurfSpots/beacons public IEnumerable <SurfSpot> Get(string search) { var surfSpotRepository = new SurfSpotRepository(); var surfSpots = surfSpotRepository.Retrieve(); return(surfSpots.Where(s => s.Location.ToLower().Contains(search))); }
// GET: api/SurfSpots/5 public SurfSpot Get(int id) { SurfSpot spot; var surfSpotRepository = new SurfSpotRepository(); if (id > 0) { var surfSpots = surfSpotRepository.Retrieve(); spot = surfSpots.FirstOrDefault(s => s.SpotId == id); } else { spot = surfSpotRepository.Create(); } return(spot); }