public void AddAuthority(DnsResourceRecord record) { if (record == null) { throw new ArgumentNullException(nameof(record)); } Authorities.Add(record); }
/// <summary> /// process, add new authority for... /// submission choices... /// {"LADCode": "E00060060", "Name": "Widdicombe Sands" } /// {"TouchpointID":"0000000102", "LADCode": "E00060060", "Name": "Widdicombe Sands" } /// </summary> /// <param name="theTouchpoint">the touchpoint</param> /// <param name="usingContent">using content</param> /// <param name="inScope">in scope</param> /// <returns>the result of the operation</returns> public async Task <HttpResponseMessage> ProcessAddNewAuthorityFor( string theTouchpoint, string usingContent, IScopeLoggingContext inScope) { await inScope.EnterMethod(); It.IsEmpty(theTouchpoint) .AsGuard <ArgumentNullException>(nameof(theTouchpoint)); It.IsEmpty(usingContent) .AsGuard <ArgumentNullException>(nameof(usingContent)); await inScope.Information($"deserialising the submitted content: '{usingContent}'"); var theCandidate = JsonConvert.DeserializeObject <IncomingLocalAuthority>(usingContent); It.IsNull(theCandidate) .AsGuard <MalformedRequestException>(nameof(ILocalAuthority.LADCode)); await inScope.Information("deserialisation complete..."); if (It.IsEmpty(theCandidate.TouchpointID)) { await inScope.Information($"applying missing touchpoint details: '{theTouchpoint}'"); theCandidate.TouchpointID = theTouchpoint; } await inScope.Information($"validating the candidate: '{theCandidate.LADCode}'"); await Authority.Validate(theCandidate); await inScope.Information($"validation complete..."); await inScope.Information($"adding the candidate: '{theCandidate.LADCode}'"); var result = await Authorities.Add(theCandidate); await inScope.Information($"candidate addition complete..."); await inScope.Information($"preparing response..."); var response = Respond.Created().SetContent(result); await inScope.Information($"preparation complete..."); await inScope.ExitMethod(); return(response); }
/// <summary> /// Populate Region Counrty Sector Document /// </summary> /// <param name="languageID"></param> public void PopulateSearchFilter(Guid languageID) { //Countries var countries = CountryService.GetCountries(languageID); Countries = new List <KeyValue>(); foreach (var country in countries) { Countries.Add(new KeyValue { Key = country.ID.ToString(), Value = country.Name }); } //this.Countries.Insert(0, new KeyValue { Key = "", Value = "Country" }); //regions var regions = RegionService.GetRegions(languageID).OrderBy(r => r.Region.Type).ThenBy(r => r.Name); this.Regions = new List <GroupedSelectListItem>(); foreach (var region in regions) { this.Regions.Add(new GroupedSelectListItem { GroupKey = region.Region.Type == RegionType.Economical ? "2" : "1", GroupName = region.Region.Type == RegionType.Economical ? "Economical" : "Geographical", Text = region.Name, Value = region.ID.ToString() }); } //this.Regions.Insert(0, new GroupedSelectListItem { GroupKey = "", GroupName = "", Text = "Region", Value = "" }); //Authority Guid authorityID = new Guid(AppSettingsUtility.GetString(AppSettingsKeys.AuthorityVariableID)); var listauthority = SearchServices.GetAuthority(languageID, authorityID); this.Authorities = new List <KeyValue>(); Authorities.Add(new KeyValue { Key = "", Value = "--Select One --" }); foreach (var authorities in listauthority) { Authorities.Add(new KeyValue { Key = authorities.ToString(), Value = authorities.ToString() }); } //Documents Guid documentTypeVariableID = new Guid(AppSettingsUtility.GetString(AppSettingsKeys.DocumentTypeVariableID)); var choiceLanguages = VariableService.GetChoiceOptions(languageID, documentTypeVariableID); this.DocumentTypes = new List <KeyValue>(); foreach (var choiceLanguage in choiceLanguages) { this.DocumentTypes.Add(new KeyValue { Key = choiceLanguage.ID.ToString(), Value = choiceLanguage.Name }); } }