public List<SubCategoryDetails> getAllSubCategory() { List<SubCategoryDetails> AllCategory = new List<SubCategoryDetails>(); DBHelper helper = new DBHelper(); DataSet ds = helper.executeSelectQuery(PROCEDURES.GET_ALL_CATEGORY); if(ds!=null) { foreach (DataRow row in ds.Tables[0].Rows) { SubCategoryDetails sub = new SubCategoryDetails(); sub.Cat_Name=row["Cat_Name"].ToString(); sub.Sub_Cat_Id=Convert.ToInt32(row["Sub_Cat_Id"]); sub.Sub_Cat_Name = row["Sub_Cat_Name"].ToString(); AllCategory.Add(sub); } } return AllCategory; }
public int updateSubCategory(SubCategoryDetails sub) { DBHelper helper = new DBHelper(); SqlParameter[] param = new SqlParameter[3]; param[0] = new SqlParameter(CONSTANT.SUB_CATEGORY_ID, sub.Sub_Cat_Id); param[1] = new SqlParameter(CONSTANT.SUB_CAT_NAME, sub.Sub_Cat_Name); param[2] = new SqlParameter(CONSTANT.CAT_ID, sub.Cat_Name); int res = helper.executeUpdateQuery(PROCEDURES.UPDATE_SUB_CATEGORY, param); return res; }
public ActionResult EditSubCategory(SubCategoryDetails details) { Session["ControllerName"] = "Edit SubCategory"; if (Session["loginDetails"] != null) { ProductAdminBLL bll = new ProductAdminBLL(); GetSubCategoryDDL(); int res = bll.updateSubCategory(details); if (res > 0) { return RedirectToAction("SubCategory", "ProdAdmin"); } return View(); } else { return RedirectToAction("Error"); } }