Exemplo n.º 1
0
        public IActionResult ManuallyAddRecipe(AddRecipeForm form)
        {
            if (authProvider.IsLoggedIn)
            {
                Recipe r = new Recipe()
                {
                    Name         = form.Name,
                    Description  = form.Description,
                    DateAdded    = DateTime.Now,
                    Source       = form.Source,
                    PrepMinutes  = form.PrepMinutes,
                    CookMinutes  = form.CookMinutes,
                    UserWhoAdded = authProvider.GetCurrentUser(),

                    Steps          = form.ParseSteps(),
                    ImageLocations = form.ParseImageLocations(),
                    Ingredients    = form.ParseIngredients()
                };

                if (recipeDAL.AddRecipe(r) != null)
                {
                    return(View("Recipe", r));
                }
                else
                {
                    return(View("Error"));
                }
            }
            else
            {
                return(RedirectToAction("Login", "Account"));
            }
        }
Exemplo n.º 2
0
 public IActionResult ManuallyAddRecipe()
 {
     if (authProvider.IsLoggedIn)
     {
         AddRecipeForm model = new AddRecipeForm();
         model.UserIdWhoAdded = authProvider.GetCurrentUser().Id;
         return(View(model));
     }
     else
     {
         return(RedirectToAction("Login", "Account"));
     }
 }