public IHttpActionResult GetPlantByMedicianlResistanceAndToxicity(GetSpecialDetailsModel model) { PlantService plantService = CreatePlantService(); var specialDetails = plantService.GetPlantByMedicinalResistanceAndToxicity(model); return(Ok(specialDetails)); }
//GetPlantsByMedicinal will return a list of plants that are true for either IsMedicinal, IsDeerResistant, IsToxicToAnimal, or IsToxicToHuman. Each plant will be built out using the // BuildPlantDetailsModel, which mainly gets data from the PlantDetails class. public IEnumerable <PlantDetailsModel> GetPlantByMedicinalResistanceAndToxicity(GetSpecialDetailsModel model) { var query = ctx.PlantDetails.Where(e => (e.IsMedicinal == model.IsMedicinal) || (e.IsDeerResistant == model.IsDeerResistant) || (e.IsToxicToAnimal == model.IsToxicToAnimal) || (e.IsToxicToHuman == model.IsToxicToHuman)).ToArray().Select(f => BuildPlantDetailsModel(f)); return(query.ToList()); }