public ActionResult AddCategory(Category category) { dao = new CategoryDao(); bool check = dao.AddCategory(category); if (check) { return(RedirectToAction("CategoryManager", "HomeAd")); } else { return(JavaScript("<script>alert('Thêm không thành công')</script>")); } }
private void btnAdd_Click(object sender, EventArgs e) { if (txtName.Text == "") { MessageBox.Show("Please enter category name"); } else { CategoryDao cd = new CategoryDao(); if (cd.AddCategory(txtName.Text)) { MessageBox.Show("Add successful"); } load(); } }