public IEnumerable <string> GetByUserID(string ID) { List <UserRole> listUserRole = new List <UserRole>(); var data = _userRoleRepository.GetMany(u => u.IsDelete == false && u.UserID.Equals(ID)); foreach (var item in data) { listUserRole.Add(item); } List <PermissionOfRole> listPermissionOfRole = new List <PermissionOfRole>(); foreach (var item in listUserRole) { var getByRoleID = _permissionOfRoleRepository.GetMany(p => p.IsDelete == false && p.RoleID == item.RoleID); foreach (var permissionItem in getByRoleID) { listPermissionOfRole.Add(permissionItem); } } List <string> listNameOfPermission = new List <string>(); foreach (var permission in listPermissionOfRole) { listNameOfPermission.Add(_permissionRepository.GetById(permission.PermissionID).Name); } return(listNameOfPermission); }
public IEnumerable <PermissionOfRole> GetByPermission(Guid ID) { return(_permissionOfRoleRepository.GetMany(p => p.IsDelete == false && p.PermissionID == ID)); }