public ActionResult Cart() { List <Cartvm1> cartlist = new List <Cartvm1>(); try { if (Session["cartnumber"] != null) { dbcon.Open(); int cartnumber = (int)Session["cartnumber"]; //int cartnumber = 100; cartlist = Cartvm1.GetCartList(dbcon, cartnumber); dbcon.Close(); } return(View(cartlist)); } catch (Exception ex) { if (dbcon.State == ConnectionState.Open) { dbcon.Close(); } ViewBag.errmsg = ex.Message; return(View("_Error")); } }
public ActionResult Cart() { try { dbcon.Open(); List <Cartvm1> cart = Cartvm1.GetCartList(dbcon, 100); dbcon.Close(); return(View(cart)); } catch (Exception ex) { throw new Exception(ex.Message); } }
public ActionResult Cart() { List <Cartvm1> cartlist = new List <Cartvm1>(); try { if (Session["cartnumber"] != null) { dbcon.Open(); int cartnumber = (int)Session["cartnumber"]; cartlist = Cartvm1.GetCartList(dbcon, cartnumber); dbcon.Close(); } return(View(cartlist)); } catch (Exception ex) { throw new Exception(ex.Message); } }
// GET: Shopping public ActionResult Cart() { List <Cartvm1> cart; // int cartid = 100; int cartid = 0; if (Session["cartnumber"] != null) { cartid = Convert.ToInt32(Session["cartnumber"].ToString()); } try { dbcon = GetConnection(); dbcon.Open(); cart = Cartvm1.GetCartList(dbcon, cartid); dbcon.Close(); } catch (Exception ex) { throw new Exception(ex.Message); } return(View(cart)); }