コード例 #1
0
        public IEnumerable <Plant> Get([FromQuery] int typeId, [FromQuery] int locationId)
        {
            if (!string.IsNullOrEmpty(Request.Query["typeId"]) && !string.IsNullOrEmpty(Request.Query["locationId"]))
            {
                return(PlantService.getPlantsByType(typeId).Where(p => p.LocationId == locationId).ToList());
            }

            if (!string.IsNullOrEmpty(Request.Query["typeId"]))
            {
                return(PlantService.getPlantsByType(typeId));
            }

            if (!string.IsNullOrEmpty(Request.Query["locationId"]))
            {
                return(PlantService.getPlantsByLocation(locationId));
            }


            return(PlantService.getPlants());
        }