public ActionResult Create(HR_Example.Models.Dept dept) { try { string sql = "Dept_insert_"; SqlParameter [] sqlParameter = new SqlParameter[1]; sqlParameter[0] = new SqlParameter("@Dept_Name", dept.Dept_Name); func.ExecuteNonQuery(sql, sqlParameter); // TODO: Add insert logic here return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult Edit(int id, HR_Example.Models.Dept dept) { try { // TODO: Add update logic here string sql = "Dept_update"; SqlParameter[] sqlParameter = new SqlParameter[2]; sqlParameter[0] = new SqlParameter("@Dept_Id", id); sqlParameter[1] = new SqlParameter("@Dept_Name", dept.Dept_Name); func.ExecuteNonQuery(sql, sqlParameter); return(RedirectToAction("Index")); } catch { return(View()); } }