public static List <QuyenNhomNguoiDungDTO> TimQuyenNguoiDung(string username) { QlTourDuLichEntities thucThe = new QlTourDuLichEntities(); List <int?> maNhomList = thucThe.QUANLINHOMNGUOIDUNGs.Select(t => t.MaNhom).ToList(); List <QuyenNhomNguoiDungDTO> quyenNguoiDungLst = new List <QuyenNhomNguoiDungDTO>(); foreach (int item in maNhomList) { try { var ketQua = (from phanQuyen in thucThe.PHANQUYENs where phanQuyen.MaNhom == item select new QuyenDTO() { CoQuyen = phanQuyen.CoQuyen, MaMH = phanQuyen.MaMH }).ToList(); quyenNguoiDungLst.Add(new QuyenNhomNguoiDungDTO(item, ketQua)); } catch (Exception) { throw; } } return(quyenNguoiDungLst); }