Exemplo n.º 1
0
        public IActionResult CreateMeal(int id = 0)

        {
            ViewBag.ExistingRecipes = recipeDAL.GetAllRecipes();

            MealViewModel mealViewModel = new MealViewModel();
            Meal          meal          = mealPlanDAL.GetMealById(id);

            mealViewModel.ModelMeal = meal;
            Console.WriteLine(mealViewModel.ModelMeal.Name);
            ViewBag.RecipeCount = meal.Recipes.Count;

            return(View("CreateMeal", mealViewModel));
        }
        public IActionResult AllRecipes()
        {
            if (authProvider.GetCurrentUser() == null)
            {
                TempData["ErrorMessage"] = "You must login to View All Recipes!";
                return(RedirectToAction("Login", "Account"));
            }

            List <Recipe> allRecipes = recipeDAL.GetAllRecipes();

            return(View(allRecipes));
        }
Exemplo n.º 3
0
        // GET: Home
        public ActionResult Index()
        {
            List <Recipe> recipes = recipeDal.GetAllRecipes();

            return(View("Index", recipes));
        }