示例#1
0
        public ActionResult Cart()
        {
            double?margin = 0;

            if (Session["SelectedCustomerId"] == null || Session["SelectedCustomerId"].ToString() == "")
            {
                TempData["msg"] = "Please select the customer first.";
                return(RedirectToAction("SelectCustomers"));
            }
            else
            {
                if (TempData["Margin"] == null)
                {
                    margin = GetCustomerMargin();
                    if (margin == null || margin == 0)
                    {
                        ViewModel.DefaultMargin.DefaultMarginUser defaultMarginUsers = new ViewModel.DefaultMargin.DefaultMarginUser();
                        margin = defaultMarginUsers.GetDefaultMargin().DefaultPercentage;
                    }
                    if (margin == null)
                    {
                        margin = 0;
                    }
                    TempData["Margin"] = margin;
                    Session["Margin"]  = margin;
                }
                TMRC_CSP.ViewModel.AddToCart.AddToCart cart = new TMRC_CSP.ViewModel.AddToCart.AddToCart();
                return(View(cart.Get(ViewModel.Account.Login._r.Id, Session["SelectedCustomerId"].ToString(), true)));
            }
        }
示例#2
0
 public ActionResult DefaultMarginUser()
 {
     ViewModel.DefaultMargin.DefaultMarginUser dmu = new ViewModel.DefaultMargin.DefaultMarginUser();
     return(View(dmu.GetDefaultMargin()));
 }