Пример #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request["id"] != null)
            {
                int id = int.Parse(Request["id"].ToString());

                SQLLibrary.Product product = SQLLibrary.MySql.ReadProducts().FirstOrDefault(x => x.ID == id);

                labelProductInfo.Text  = product.ProductDescription;
                ImageProduct.ImageUrl  = product.PictureUrl;
                labelProductPrice.Text = "Produktnamn: " + product.Soldnr.ToString() + "<br/>" + "<br/>" +
                                         "Artikelnummer: " + product.ID.ToString() + "<br/>" + "<br/>" + "<br/>" + "<br/>" +
                                         "Pris: " + product.Price.ToString();
            }
        }
Пример #2
0
        protected void buttonAddProduct_Click(object sender, EventArgs e)
        {
            if (Request["id"] != null)
            {
                int numberOfCartItems;

                int id = int.Parse(Request["id"].ToString());
                SQLLibrary.Product product = SQLLibrary.MySql.ReadProducts().FirstOrDefault(x => x.ID == id);

                List <Product> products = new List <Product>();
                if (Session["productList"] != null)
                {
                    products = (List <Product>)Session["productList"];
                }

                products.Add(product);

                Session["productList"] = products;
            }
        }