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 })); } }
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")); }
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)); } }