public void GetGeocacheEntityByName() { GeocacheQuery query = new GeocacheQuery { Name = "Test Geocache 2" }; Assert.True(geocacheController.Get(query).Count > 0); }
/// <summary> /// Return a list of Geocaches based on query parameters /// If no query parameters are given, the method will return all geocaches in the database /// </summary> /// <param name="query"></param> /// <returns>List<GeocacheEntity></returns> public List <GeocacheEntity> Get(GeocacheQuery query) { var result = _context.Geocache.AsNoTracking(); // If a name is given in the query, the database will return geocaches with matching names if (!string.IsNullOrWhiteSpace(query.Name)) { result = result.Where(x => x.Name.ToLower() == query.Name.ToLower()); } /* Latitude and longitude are included in the query object but not used here * With further time and research a query could be built, but as of right now * the proper search method for finding an object via latitude/longitude is unknown */ return(result.ToList()); }
public void GetAllGeocaches() { GeocacheQuery query = new GeocacheQuery(); Assert.True(geocacheController.Get(query).Count > 0); }
public List <GeocacheEntity> Get([FromQuery] GeocacheQuery query) { return(client.Get(query)); }