示例#1
0
 public void OnGet(string FirstName, string LastName, string Email)
 {
     EmailKey = new FirstnameLastnameEmail()
     {
         Email = "*****@*****.**", Firstname = "ja", Lastname = "jaaa"
     };
     _User = _userManager.GetUserAsync(User).Result;
 }
示例#2
0
        public void OnGet(string FirstName, string LastName, string Email)
        {
            //Store FirstName, LastName and Email in an class
            EmailKey = new FirstnameLastnameEmail()
            {
                Email = Email, Firstname = FirstName, Lastname = LastName
            };

            if (User.Identity.IsAuthenticated)
            {
                id    = _userManager.GetUserId(User);
                _User = _userManager.GetUserAsync(User).Result;
                var query2 = from shop in _context.Shopping_card
                             where shop.User_ID == id
                             select shop;
                YourCart = query2.FirstOrDefault();

                var query = from shopping in _context.Shopping_card
                            where shopping.User_ID == id
                            let shoppingProducts = (
                    from shoppingProdutstable in _context.Shopping_Card_Products
                    from Products in _context.Product
                    where shoppingProdutstable.Shopping_card_ID == shopping.ID &&
                    shoppingProdutstable.Product_ID == Products.ID
                    select new ResponseShopingCart()
                {
                    product = Products, quantity = shoppingProdutstable.quantity + 1
                }
                    ).ToList()
                                                   select shoppingProducts;
                _Products = query.FirstOrDefault();
            }
            else
            {
                string cookieshoping = Request.Cookies["ShoppingCart"];
                List <shoppingCart_cookie> shoppingcartlist = Cookie.Cookiereader_shoppingcart(cookieshoping);
                _Products = new List <ResponseShopingCart>();

                foreach (shoppingCart_cookie item in shoppingcartlist)
                {
                    var query = from product in _context.Product
                                where product.ID == item.ProductID
                                select product;

                    _Products.Add(new ResponseShopingCart()
                    {
                        product = query.FirstOrDefault(), quantity = item.Quantity
                    });
                }
            }
        }