コード例 #1
0
 public void OnGet()
 {
     if (Vegetarian == false)
     {
         Recipes = rr.GetAllRecipesWithIngredients();
     }
     else
     {
         Recipes = rr.GetAllRecipesWithIngredients().Where(r => r.Vegetarian == true).ToList();
     }
 }
コード例 #2
0
        public void OnGet()
        {
            FilterType = FilterType.ToLower();

            if (FilterType != "all")
            {
                Recipes = recipeRepository.GetAllRecipesWithIngredients();
                if (FilterType == "nonvegan")
                {
                    Recipes.RemoveAll(x => x.IsVegetarian);
                }
                else if (FilterType == "vegan")
                {
                    Recipes.RemoveAll(x => !x.IsVegetarian);
                }
                return;
            }
            Recipes = recipeRepository.GetAllRecipes();
        }
コード例 #3
0
 public void OnGet()
 {
     Ingredients = new SelectList(ir.GetAllIngredients(), "Id", "Name");
     Recipes     = rr.GetAllRecipesWithIngredients();
 }