public static List<SiteGroup> ListSiteGroup(int? orgId, int? siteGroupId) { DataLayer dataLayer = new DataLayer(); List<SiteGroup> result = dataLayer.ListSiteGroup(orgId, siteGroupId); if (result != null && result.Count > 0) { foreach (SiteGroup siteGroup in result) { siteGroup.Sites = dataLayer.ListSiteBySiteGroup(siteGroup.SiteGroupId, null); } } return result; }
public static List<Site> ListSiteBySiteGroup(int? siteGroupId, bool? showLegacy, bool loadContact) { DataLayer dataLayer = new DataLayer(); List<Site> result = dataLayer.ListSiteBySiteGroup(siteGroupId, showLegacy); if (loadContact) { foreach (Site site in result) { if (site.ContactInformationID > 0) { List<ContactInformation> contacts = dataLayer.ListContactInformation(site.ContactInformationID); if (contacts.Count > 0) { site.ContactInformation = contacts[0]; } } } } return result; }