public ActionResult Delete(int id, HR_Example.Models.Emp emp) { try { string sql = "Employee_delete"; SqlParameter[] p = new SqlParameter[1]; p[0] = new SqlParameter("@Employee_ID", id); func.ExecuteNonQuery(sql, p); return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult Create(HR_Example.Models.Emp emp) { try { string sql = "Employee_insert"; SqlParameter[] parameter = new SqlParameter[4]; parameter[0] = new SqlParameter("@Employee_Name", emp.Employee_Name); parameter[1] = new SqlParameter("@Employee_salary", emp.Employee_salary); parameter[2] = new SqlParameter("@Dept_Id", emp.Dept_ID); parameter[3] = new SqlParameter("@country_ID", emp.Country_ID); func.ExecuteNonQuery(sql, parameter); return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult Edit(int id, HR_Example.Models.Emp emp) { try { string sql = "Employee_update"; SqlParameter[] p = new SqlParameter[5]; p[0] = new SqlParameter("@Employee_ID", id); p[1] = new SqlParameter("@Employee_Name", emp.Employee_Name); p[2] = new SqlParameter("@Employee_salary", emp.Employee_salary); p[3] = new SqlParameter("@Dept_Id", emp.Dept_ID); p[4] = new SqlParameter("@country_ID", emp.Country_ID); func.ExecuteNonQuery(sql, p); return(RedirectToAction("Index")); } catch { return(View()); } }