protected void btnSubmit_Click(object sender, EventArgs e) { Logic.ShoppingCart s = new Logic.ShoppingCart { CategoryName = txtCategoryName.Text }; s.AddNewCategory(s); txtCategoryName.Text = string.Empty; Response.Redirect("~/Admin/AddNewProduct.aspx"); }
private void GetCategory() { Logic.ShoppingCart shoppingCart = new Logic.ShoppingCart(); System.Data.DataTable dataTable = shoppingCart.GetCategory(); if (dataTable.Rows.Count > 0) { categoryDropDownList.DataValueField = "CategoryId"; categoryDropDownList.DataTextField = "CategoryName"; categoryDropDownList.DataSource = dataTable; categoryDropDownList.DataBind(); } }
protected void btnSubmit_Click(object sender, EventArgs e) { if (uploadProductImage.PostedFile != null) { SaveProductPhoto(); Logic.ShoppingCart shoppingCart = new Logic.ShoppingCart() { ProductName = txtProductName.Text, ProductImage = "~/ProductImages/" + uploadProductImage.FileName, ProductPrice = txtProductPrice.Text, ProductDescritpion = txtProductDescription.Text, CategoryId = Convert.ToInt32(categoryDropDownList.SelectedValue), }; shoppingCart.AddNewProduct(shoppingCart); ClearText(); } else { Response.Write("<script>alert('Need upload image for creating new product.')</script>"); } }