protected void btnSave_OnServerClick(object sender, EventArgs e) { var categoryName = Request.Form["selectCategories"]; var categoryID = _categoryDal.GetCategoryID(categoryName); var brandName = Request.Form["selectBrands"]; var brandID = _brandDal.GetID(brandName); string productName = Request.Form["productname"]; string averagePrice = Request.Form["averageprice"]; string productFeatures = Request.Form["productfeatures"]; _productDal.ProductAdd(new Product { ProductName = productName, CategoryID = categoryID, BrandID = brandID, AveragePrice = int.Parse(averagePrice), ProductFeatures = productFeatures, ProductImage_1 = _imagePath + categoryName + @"s\" + productimage1.Value, ProductImage_2 = _imagePath + categoryName + @"s\" + productimage2.Value, ProductImage_3 = _imagePath + categoryName + @"s\" + productimage3.Value, }); LoadProducts(); lblResult.Visible = true; lblResult.InnerText = "Product Added!"; }
protected void btnDelete_OnServerClick(object sender, EventArgs e) { string categoryName = Request.Form["categoryname"]; int categoryId = _categoryDal.GetCategoryID(categoryName); _categoryDal.Delete(new Category { CategoryID = categoryId, }); End("Category Deleted!"); }