コード例 #1
0
 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());
     }
 }
コード例 #2
0
 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());
     }
 }
コード例 #3
0
 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());
     }
 }