Пример #1
0
        public ActionResult Order(Cart_Lineitem cart)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    dbcon.Open();
                    // cart.CartNumber = 100; //use Session["cartnumber"] later

                    //added-->
                    if (Session["cartnumber"] == null)
                    {
                        Session["cartnumber"] = Utility.GetIdNumber(dbcon, "CartNumber");
                    }

                    int cartnumber = (int)Session["cartnumber"];
                    //<--added
                    cart.CartNumber = cartnumber;
                    int intresult = Cart_Lineitem.CartUpSert(dbcon, cart);
                    dbcon.Close();
                    return(RedirectToAction("Cart"));
                }
                catch (Exception ex) { throw new Exception(ex.Message); }
            }
            ViewBag.errormsg = "Invalid data found in Order Page";
            return(View("error"));
        }
Пример #2
0
 public ActionResult Order(Cart_Lineitem cart)
 {
     if (ModelState.IsValid)
     {
         try
         {
             dbcon.Open();
             cart.CartNumber = 100; //use Session["cartnumber"] later
             int intresult = Cart_Lineitem.CartUpSert(dbcon, cart);
             dbcon.Close();
             return(RedirectToAction("Cart"));
         }
         catch (Exception ex) { throw new Exception(ex.Message); }
     }
     ViewBag.errormsg = "Invalid data found in Order Page";
     return(View("error"));
 }
Пример #3
0
 public ActionResult Order(Cart_Lineitem cart)
 {
     if (ModelState.IsValid)
     {
         try
         {
             dbcon.Open();
             if (Session["cartnumber"] == null)
             {
                 Session["cartnumber"] = Utility.GetIdNumber(dbcon, "CartNumber");
             }
             int cartnumber = Convert.ToInt32(Session["cartnumber"].ToString());
             cart.CartNumber = cartnumber;
             int intresult = Cart_Lineitem.CartUpSert(dbcon, cart);
             dbcon.Close();
             return(RedirectToAction("Cart"));
         }
         catch (Exception ex) { throw new Exception(ex.Message); }
     }
     ViewBag.errormsg = "Invalid data found in Order Page";
     return(View("error"));
 }