public IEnumerable <IngredientDto> GetIngredientByCategory(string name) { IngridientsList l = new IngridientsList(this.ingredientRepository); var f = l.GetIngridientsByCategory(name); return(f); }
public IHttpActionResult Get() { IngridientsList list = new IngridientsList(_ingredientRepository); List <CategoryIngredients> result = new List <CategoryIngredients>(); List <CategoryDto> categories = list.GetIngredientCategories(); foreach (var category in categories) { CategoryIngredients categoryIngredients = new CategoryIngredients(); categoryIngredients.Category = category; categoryIngredients.Ingredients = list.GetIngridientsByCategory(category.Name); result.Add(categoryIngredients); } return(Ok(result)); }