예제 #1
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));
            //}
        }
예제 #2
0
        public ActionResult CheckOutLogIn(FormCollection frmCollection)
        {
            //Double chk to ensure this profile is in the userprofile table incase back button was used
            var cartid = sc.GetCartId(this.HttpContext);

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

            //Check if person exists
            //var ChkCusomer = storeDB.CustomerDetails.Single(x => x.Username == frmCollection["UserName"].ToString());
            string dbUserName = frmCollection["UserName"].ToString().Trim();
            string dbPwd      = frmCollection["Password"].ToString().Trim();

            if (sc.CheckMembership(dbUserName, dbPwd))
            {
                //Update tblUserProfile with correct UserName
                sc.UpdatetblUserProfileWithCurrentUserName(dbUserName, cartid);

                //Put a protection block incase the back button is pressed on the site
                decimal id = 0;
                if (cartid == null || cartid == "" || dbUserName == "" || dbUserName == null)
                {
                    return(View("Error"));
                }
                else
                {
                    id = sc.CreateOrder(cartid, dbUserName);
                    BusinessLayer.SendEmails em = new BusinessLayer.SendEmails();
                    em.ProcessEmail(cartid);

                    return(RedirectToAction("Complete", "CheckOut", new { id = id }));
                }
                //Send Email on order
            }
            else
            {
                return(View("ErrorIndex"));
            }
        }