public ActionResult Baking(string Item) { if (ModelState.IsValid) { var ItemToShoppingCartItemFactory = new ItemToShoppingCartItemFactory(); var user = User.Identity.Name; ItemToShoppingCartItemFactory.TransformItem(Item, user); return(RedirectToAction("Baking")); } else { return(View()); } }
public ActionResult Plant(string Item) { if (ModelState.IsValid) { var ItemToShoppingCartItemFactory = new ItemToShoppingCartItemFactory(); //var user = ((System.Security.Claims.ClaimsIdentity)User.Identity).FindFirst(System.Security.Claims.ClaimTypes.NameIdentifier).Value; var user = User.Identity.Name; ItemToShoppingCartItemFactory.TransformItem(Item, user); return(RedirectToAction("Plant")); } else { return(View()); } }
public ActionResult Recipes(string recipeName) { if (ModelState.IsValid) { using (var _groceryRepoItems = new GroceryContext()) { var matchRecipeName = _groceryRepoItems.ListOfRecipes.SingleOrDefault(m => m.RecipeName == recipeName); var ItemToShoppingCartItemFactory = new ItemToShoppingCartItemFactory(); var user = User.Identity.Name; foreach (var name in matchRecipeName.Item) { ItemToShoppingCartItemFactory.TransformItem(name.Id.ToString(), user); } } return(RedirectToAction("Recipes")); } else { return(View()); } }