public List <TeacherType> List(DataTable dt) { for (int i = 0; i < dt.Rows.Count; i++) { TeacherType teachType = new TeacherType(); teachType.TeacherTypeID = Convert.ToInt32(dt.Rows[i]["TeacherTypeID"]); teachType.TypeName = dt.Rows[i]["TypeName"].ToString(); list.Add(teachType); } return(list); }
public List <Teacher> List(DataTable dt) { for (int i = 0; i < dt.Rows.Count; i++) { Teacher teacherObj = new Teacher(); teacherObj.TeacherID = Convert.ToInt32(dt.Rows[i]["TeacherID"]); teacherObj.TeacherName = dt.Rows[i]["TeacherName"].ToString(); teacherObj.Phone = dt.Rows[i]["Phone"].ToString(); teacherObj.Email = dt.Rows[i]["Email"].ToString(); teacherObj.TeachingHours = Convert.ToInt32(dt.Rows[i]["TeachingHours"]); teacherObj.TeacherTypeID = Convert.ToInt32(dt.Rows[i]["TeacherTypeID"]); TeacherType teacherTypeObj = new TeacherType(); teacherTypeObj.TypeName = dt.Rows[i]["TypeName"].ToString(); teacherObj.TeacherType = teacherTypeObj; list.Add(teacherObj); } return(list); }