コード例 #1
0
        //BusinessLayer.ShoppingCartViewModel ShopCVM = new BusinessLayer.ShoppingCartViewModel();
        //BusinessLayer.ShoppingCartRemoveViewModel shopRemoveCVM = new BusinessLayer.ShoppingCartRemoveViewModel();

        public ActionResult Index()
        {
            //string id = sc.
            var cart = QuickySaleOnlineShopper.Models.ShoppingCart.GetCart(this.HttpContext);
            //BusinessLayer.ShoppingCart cart2 = BusinessLayer.ShoppingCart.GetCart(this.HttpContext);

            //var fd = storeDB.StoreCarts.Include("FoodItems").Where(grp => grp.StoreCartId == (string)cart2.GetCartId(this.HttpContext)).ToList();
            // Set up our ViewModel
            // var giveModel = new MVCQuickySale.Models.StoreCart();
            var cartid = sc.GetCartId(this.HttpContext);
            var fd     = storeDB.StoreCarts.Include("FoodItems").Where(grp => grp.StoreCartId == (string)cartid);
            //var fdsc = sc.GetCartItems((string)cartid);
            //
            var viewModel = new QuickySaleOnlineShopper.ViewModels.ShoppingCartViewModel
            {
                StoreCart = cart.GetCartItems(),
                CartTotal = cart.GetTotal(),
                //cartid = cart.GetCartId
            };

            //string cartid = viewModel.StoreCart.
            // Return the view
            if (viewModel.StoreCart.Count > 0)
            {
                //return View(viewModel);
                return(View("Index", fd));
            }
            else
            {
                return(View("EmptyCart"));
            }
        }
コード例 #2
0
        public static ShoppingCart GetCart(HttpContextBase context)
        {
            var cart = new ShoppingCart();

            cart.ShoppingCartId = cart.GetCartId(context);
            return(cart);
        }
コード例 #3
0
        public ActionResult Create(BusinessLayer.CustomerDetail values)
        {
            if (ModelState.IsValid)
            {
                // try
                //{ Check if this new email already exists on DB
                if (!dbset.ConfirmEmailIsUnique(values.Email.ToString()))
                {
                    var order  = new BusinessLayer.CustomerDetail();
                    var cartid = sc.GetCartId(this.HttpContext);

                    //Create new member into the database
                    sc.CreateMember(values);//customerDetail

                    //send admin an email to call and confirm new user
                    BusinessLayer.SendEmails sendmail = new SendEmails();
                    sendmail.NewCustomerEmail(values);


                    //Update tblUserProfile with correct UserName
                    sc.UpdatetblUserProfileWithCurrentUserName(values.Email.Trim(), cartid);

                    return(RedirectToAction("Index", "ShoppingCart"));
                }
                else
                {
                    ViewBag.StateId = new SelectList(dbset.States, "StateId", "StateName");
                    return(View("NotUniqueEmailIndex"));
                }
            }
            ViewBag.StateId = new SelectList(dbset.States, "StateId", "StateName");

            return(View());
        }
コード例 #4
0
        //[OutputCache(Duration=600)]
        public ActionResult Index()
        {
            //Get Guest as login detail
            var cartid = sc.GetCartId(this.HttpContext);

            if (!sc.ConfirmMemberisLoggedIn(cartid))
            {
                sc.AddGuestBrowserTotblUserProfile(cartid);
            }



            //ViewData["MobileFoodGroup"]

            /* if ((Request.Browser.IsMobileDevice)) {
             *       if (Request.UserAgent.IndexOf("mobile", StringComparison.OrdinalIgnoreCase) < 1)  //(Request.Browser.IsMobileDevice)
             *       {
             *
             *               var topFoods = GetTopSellingAlbums(6);
             *               return View(topFoods);
             *
             *
             *       }
             *       else if (Request.UserAgent.IndexOf("mobile", StringComparison.OrdinalIgnoreCase) >=1)
             *       {
             *           // var Foodgrp = storeDB.FoodGroups.ToList();
             *           return RedirectToAction("Index", "Store");
             *       }
             *
             *       else
             *       {
             *           var topFoods = GetTopSellingAlbums(6);
             *           return View(topFoods);
             *       }
             *       }
             * else
             * {*/
            var topFoods = GetTopSellingAlbums(6);

            return(View(topFoods));
            //}
        }