public static int Update(int id, Deptcs deptcs) { using (SqlConnection sqlCon = new SqlConnection(ConfigurationManager.ConnectionStrings["MyConnection"].ConnectionString)) { return(sqlCon.Execute("exec SP_Update_Department @id,@Name,@Manager,@Division_Id", new { Id = id, Name = deptcs.Name_Department, Manager = deptcs.Manager, Division_Id = deptcs.Division_Id })); } }
public static int Insert(Deptcs deptcs) { using (SqlConnection sqlCon = new SqlConnection(ConfigurationManager.ConnectionStrings["MyConnection"].ConnectionString)) { var affectedRow = sqlCon.Execute("exec SP_Insert_Department @Name,@Manager,@Division_Id", new { Name = deptcs.Name_Department, Manager = deptcs.Manager, Division_Id = deptcs.Division_Id }); return(affectedRow); } }