예제 #1
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            if (uploadProductPhoto.PostedFile != null)
            {
                SaveProductPoto();

                ShoppingCart k = new ShoppingCart()
                {
                    ProductName = txtProductName.Text,
                    ProductImage = "~/ProductImages/" + uploadProductPhoto.FileName,
                    ProductPrice = Int32.Parse( txtProductPrice.Text),
                    ProductDescription = txtProductDescription.Text,
                    CategoryID = Convert.ToInt32(ddlCategory.SelectedValue)
                };
                k.AddNewProduct();
                ClearText();
                Response.Redirect("~/Admin/AddNewProducts.aspx?alert=success");
            }
            else
            {
                Response.Redirect("<script>alert('Please Upload Photo');</script>");
            }
        }