private Website GetWebsiteIfExists() { WebsiteParameters websiteParameters = null; if (WebsiteProperties != null) { websiteParameters = WebsiteProperties.WebsiteParameters; } Name = Name ?? WebsiteProperties.Name; if (Name == null) { throw new FluentManagementException("No name defined for website", "WebsiteClient"); } // get the list of all sites var siteList = List(); // search for the name of the site in the list var site = siteList.FirstOrDefault(a => a.Name.ToLowerInvariant() == Name.ToLowerInvariant()); // make sure that the site exists if (site == null) { throw new FluentManagementException("No site found in this subscription with the name" + Name, "WebsiteClient"); } // get the website configuration var command = new GetWebsiteConfigCommand(site) { SubscriptionId = SubscriptionId, Certificate = ManagementCertificate }; command.Execute(); site.Config = command.Config; site.WebsiteParameters = site.WebsiteParameters ?? websiteParameters; return(WebsiteProperties = site); }
private Website GetWebsiteIfExists() { WebsiteParameters websiteParameters = null; if(WebsiteProperties != null) websiteParameters = WebsiteProperties.WebsiteParameters; Name = Name ?? WebsiteProperties.Name; if (Name == null) throw new FluentManagementException("No name defined for website", "WebsiteClient"); // get the list of all sites var siteList = List(); // search for the name of the site in the list var site = siteList.FirstOrDefault(a => a.Name.ToLowerInvariant() == Name.ToLowerInvariant()); // make sure that the site exists if (site == null) throw new FluentManagementException("No site found in this subscription with the name" + Name, "WebsiteClient"); // get the website configuration var command = new GetWebsiteConfigCommand(site) { SubscriptionId = SubscriptionId, Certificate = ManagementCertificate }; command.Execute(); site.Config = command.Config; site.WebsiteParameters = site.WebsiteParameters ?? websiteParameters; return WebsiteProperties = site; }