protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["productID"] == null) { Response.Redirect("~/AccessDenied.aspx"); } DAO.Product dp = new DAO.Product(); pid = int.Parse(Request.QueryString["productID"].ToString()); Model.Cart c = new Model.Cart(); if (pid > 0) { Model.Product p = dp.GetProductsCartById(pid); c.Cart_id = int.Parse(Session["CartId"].ToString()); c.Pid = p.Pid; c.Pimage = p.Pimage; c.Uid = int.Parse(Session["UserId"].ToString()); c.Pname = p.Pname; c.Status = "pending"; c.Quantity = 1; c.Amount = p.Pprice; c.Createdon = DateTime.Now; Controller.Cart cc = new Controller.Cart(); Response.Write(cc.AddToCartValidate(c)); Response.Redirect("ShoppingCart.aspx"); } }
protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["productID"] == null) { Response.Redirect("~/AccessDenied.aspx"); } DAO.Product p = new DAO.Product(); int id = int.Parse(Request.QueryString["productID"].ToString()); productDetail.DataSource = p.GetProductsById(id); productDetail.DataBind(); }