public static List<Organisation> ListOrganisation(Guid? roleId) { DataLayer dataLayer = new DataLayer(); List<Organisation> result = dataLayer.ListOrganisation(); if (roleId.HasValue) { foreach (Organisation org in result) { org.ContactInformation = dataLayer.ListContactInformation(org.ContactInformationId).FirstOrDefault(); org.OrgAdminUsers = dataLayer.ListUserRoleAuth(org.OrganisationId, null, roleId.Value); } } return result; }
public static List<AspUser> ListOrgAdminAspUser(int orgId, Guid roleId) { DataLayer dataLayer = new DataLayer(); List<AspUser> result = new List<AspUser>(); List<UserRoleAuth> uraList = dataLayer.ListUserRoleAuth(orgId, null, roleId); if (uraList != null) { foreach (UserRoleAuth ura in uraList) { result.AddRange(dataLayer.ListAspUser(orgId, ura.UserId, null)); } result = result.OrderByDescending(i => i.LastActivityDate).ToList(); } return result; }