public static CollegeGroupDTO BuildDto(CollegeGroup group) { var specialtyDto = BuildDto(group.Specialty); return new CollegeGroupDTO() { ID = group.ID, Number = group.Number, Specialty = specialtyDto }; }
/// <summary> /// get college news by schoolID /// </summary> /// <returns></returns> public List <CollegeGroup> getCollegeGroup(string schoolID) { string comd = "select * from CollegeType where schoolID=@schoolID"; SqlParameter[] ps = { new SqlParameter("@schoolID", schoolID) }; SQLHelper sh = new SQLHelper(); List <CollegeGroup> list = new List <CollegeGroup>(); using (SqlDataReader read = sh.getDataReader(comd, ps)) { if (read.HasRows) { while (read.Read()) { CollegeGroup group = new CollegeGroup(); group.CollegeID = read["collegeID"].ToString(); group.CollegeName = read["collegeName"].ToString(); group.SchoolID = read["schoolID"].ToString(); list.Add(group); } } } return(list); }