Exemplo n.º 1
0
        public ActionResult Assign()
        {
            if (Authenticate.IsAuthenticated())
            {
                User          user = (User)Session["user"];
                CartCustomers cc   = new CartCustomers();

                cc.Customers = CustomerManager.Load();

                cc.CustomerId = CustomerManager.Load(user.Id).Id;
                //if customer id is set by the load method, go ahead and complete the order
                if (cc.CustomerId != 0)
                {
                    Assign(cc);
                    return(RedirectToAction("Thanks"));
                }
                //An employee is logged in and needs to assign a customer
                else
                {
                    Session["cc"] = cc;
                    return(View(cc));
                }
            }
            else
            {
                return(RedirectToAction("Login", "User", new { returnurl = HttpContext.Request.Url }));
            }
        }
Exemplo n.º 2
0
        public ActionResult Assign(CartCustomers cc)
        {
            GetShoppingCart();
            User user = (User)Session["user"];

            cc.Cart = cart;
            ShoppingCartManager.Checkout(cc.Cart, user.Id, cc.CustomerId);
            Session["cc"]   = null;
            Session["cart"] = null;
            return(RedirectToAction("Thanks"));
        }
Exemplo n.º 3
0
 public ActionResult Create(Customer customer)
 {
     try
     {
         // TODO: Add insert logic here
         if (Session["cc"] == null)
         {
             CustomerManager.Insert(customer);
             return(RedirectToAction("Index"));
         }
         else
         {
             CartCustomers cc = (CartCustomers)Session["cc"];
             Session["cc"] = null;
             CustomerManager.Insert(customer);
             return(RedirectToAction("Assign", "ShoppingCart", cc));
         }
     }
     catch (Exception ex)
     {
         ViewBag.Message = ex.Message;
         return(View(customer));
     }
 }