public IActionResult GetNamed(string[] names) { return(new WebApiGet <ReferenceDataMultiCollection>(this, () => { if (names == null || names.Length == 0) { return Task.FromResult <ReferenceDataMultiCollection>(null); } List <string> allNames = null; if (IsGetNamedAllNamesSupported && names.Length == 1 && names[0] == Common.Agents.ReferenceDataAgent.GetNamedAllNames) { allNames = new List <string> { ReferenceData.Property_Gender, ReferenceData.Property_EyeColor, ReferenceData.Property_Company, }; } var coll = new ReferenceDataMultiCollection(); foreach (string name in allNames == null ? names : allNames.ToArray()) { switch (name) { case ReferenceData.Property_Gender: coll.Add(new ReferenceDataMultiItem { Name = ReferenceData.Property_Gender, Items = ReferenceData.Current[typeof(RefDataNamespace.Gender)] }); break; case ReferenceData.Property_EyeColor: coll.Add(new ReferenceDataMultiItem { Name = ReferenceData.Property_EyeColor, Items = ReferenceData.Current[typeof(RefDataNamespace.EyeColor)] }); break; case ReferenceData.Property_Company: coll.Add(new ReferenceDataMultiItem { Name = ReferenceData.Property_Company, Items = ReferenceData.Current[typeof(RefDataNamespace.Company)] }); break; } } return Task.FromResult(coll); }, operationType: OperationType.Read, statusCode: HttpStatusCode.OK, alternateStatusCode: HttpStatusCode.NoContent)); }
public IActionResult GetNamed() { return(new WebApiGet <ReferenceDataMultiCollection>(this, async() => { var coll = new ReferenceDataMultiCollection(); var inactive = this.IncludeInactive(); var refSelection = this.ReferenceDataSelection(); var names = refSelection.Select(x => x.Key).ToArray(); await ReferenceData.Current.PrefetchAsync(names); foreach (var q in refSelection) { switch (q.Key) { case var s when string.Compare(s, nameof(ReferenceData.Gender), StringComparison.InvariantCultureIgnoreCase) == 0: coll.Add(new ReferenceDataMultiItem(nameof(ReferenceData.Gender), ReferenceDataFilter.ApplyFilter <RefDataNamespace.GenderCollection, RefDataNamespace.Gender>(ReferenceData.Current.Gender, q.Value, includeInactive: inactive))); break; case var s when string.Compare(s, nameof(ReferenceData.EyeColor), StringComparison.InvariantCultureIgnoreCase) == 0: coll.Add(new ReferenceDataMultiItem(nameof(ReferenceData.EyeColor), ReferenceDataFilter.ApplyFilter <RefDataNamespace.EyeColorCollection, RefDataNamespace.EyeColor>(ReferenceData.Current.EyeColor, q.Value, includeInactive: inactive))); break; case var s when string.Compare(s, nameof(ReferenceData.PowerSource), StringComparison.InvariantCultureIgnoreCase) == 0: coll.Add(new ReferenceDataMultiItem(nameof(ReferenceData.PowerSource), ReferenceDataFilter.ApplyFilter <RefDataNamespace.PowerSourceCollection, RefDataNamespace.PowerSource>(ReferenceData.Current.PowerSource, q.Value, includeInactive: inactive))); break; case var s when string.Compare(s, nameof(ReferenceData.Company), StringComparison.InvariantCultureIgnoreCase) == 0: coll.Add(new ReferenceDataMultiItem(nameof(ReferenceData.Company), ReferenceDataFilter.ApplyFilter <RefDataNamespace.CompanyCollection, RefDataNamespace.Company>(ReferenceData.Current.Company, q.Value, includeInactive: inactive))); break; } } return coll; }, operationType: OperationType.Read, statusCode: HttpStatusCode.OK, alternateStatusCode: HttpStatusCode.NoContent));
public IActionResult GetNamed() { return(new WebApiGet <ReferenceDataMultiCollection>(this, async() => { var coll = new ReferenceDataMultiCollection(); var inactive = this.IncludeInactive(); var refSelection = this.ReferenceDataSelection(); var names = refSelection.Select(x => x.Key).ToArray(); await RefDataNamespace.ReferenceData.Current.PrefetchAsync(names).ConfigureAwait(false); foreach (var q in refSelection) { switch (q.Key) { case var s when string.Compare(s, nameof(RefDataNamespace.Gender), StringComparison.InvariantCultureIgnoreCase) == 0: coll.Add(new ReferenceDataMultiItem(nameof(RefDataNamespace.Gender), ReferenceDataFilter.ApplyFilter <RefDataNamespace.GenderCollection, RefDataNamespace.Gender>(RefDataNamespace.ReferenceData.Current.Gender, q.Value, includeInactive: inactive))); break; case var s when string.Compare(s, nameof(RefDataNamespace.TerminationReason), StringComparison.InvariantCultureIgnoreCase) == 0: coll.Add(new ReferenceDataMultiItem(nameof(RefDataNamespace.TerminationReason), ReferenceDataFilter.ApplyFilter <RefDataNamespace.TerminationReasonCollection, RefDataNamespace.TerminationReason>(RefDataNamespace.ReferenceData.Current.TerminationReason, q.Value, includeInactive: inactive))); break; case var s when string.Compare(s, nameof(RefDataNamespace.RelationshipType), StringComparison.InvariantCultureIgnoreCase) == 0: coll.Add(new ReferenceDataMultiItem(nameof(RefDataNamespace.RelationshipType), ReferenceDataFilter.ApplyFilter <RefDataNamespace.RelationshipTypeCollection, RefDataNamespace.RelationshipType>(RefDataNamespace.ReferenceData.Current.RelationshipType, q.Value, includeInactive: inactive))); break; case var s when string.Compare(s, nameof(RefDataNamespace.USState), StringComparison.InvariantCultureIgnoreCase) == 0: coll.Add(new ReferenceDataMultiItem(nameof(RefDataNamespace.USState), ReferenceDataFilter.ApplyFilter <RefDataNamespace.USStateCollection, RefDataNamespace.USState>(RefDataNamespace.ReferenceData.Current.USState, q.Value, includeInactive: inactive))); break; case var s when string.Compare(s, nameof(RefDataNamespace.PerformanceOutcome), StringComparison.InvariantCultureIgnoreCase) == 0: coll.Add(new ReferenceDataMultiItem(nameof(RefDataNamespace.PerformanceOutcome), ReferenceDataFilter.ApplyFilter <RefDataNamespace.PerformanceOutcomeCollection, RefDataNamespace.PerformanceOutcome>(RefDataNamespace.ReferenceData.Current.PerformanceOutcome, q.Value, includeInactive: inactive))); break; } } return coll; }, operationType: OperationType.Read, statusCode: HttpStatusCode.OK, alternateStatusCode: HttpStatusCode.NoContent));
public IActionResult GetNamed() { return(new WebApiGet <ReferenceDataMultiCollection>(this, () => { var coll = new ReferenceDataMultiCollection(); var inactive = this.IncludeInactive(); foreach (var q in this.ReferenceDataSelection()) { switch (q.Key) { case var s when string.Compare(s, ReferenceData.Property_Gender, StringComparison.InvariantCultureIgnoreCase) == 0: coll.Add(new ReferenceDataMultiItem(ReferenceData.Property_Gender, ReferenceDataFilter.ApplyFilter <RefDataNamespace.GenderCollection, RefDataNamespace.Gender>(ReferenceData.Current.Gender, q.Value, includeInactive: inactive))); break; case var s when string.Compare(s, ReferenceData.Property_EyeColor, StringComparison.InvariantCultureIgnoreCase) == 0: coll.Add(new ReferenceDataMultiItem(ReferenceData.Property_EyeColor, ReferenceDataFilter.ApplyFilter <RefDataNamespace.EyeColorCollection, RefDataNamespace.EyeColor>(ReferenceData.Current.EyeColor, q.Value, includeInactive: inactive))); break; case var s when string.Compare(s, ReferenceData.Property_PowerSource, StringComparison.InvariantCultureIgnoreCase) == 0: coll.Add(new ReferenceDataMultiItem(ReferenceData.Property_PowerSource, ReferenceDataFilter.ApplyFilter <RefDataNamespace.PowerSourceCollection, RefDataNamespace.PowerSource>(ReferenceData.Current.PowerSource, q.Value, includeInactive: inactive))); break; case var s when string.Compare(s, ReferenceData.Property_Company, StringComparison.InvariantCultureIgnoreCase) == 0: coll.Add(new ReferenceDataMultiItem(ReferenceData.Property_Company, ReferenceDataFilter.ApplyFilter <RefDataNamespace.CompanyCollection, RefDataNamespace.Company>(ReferenceData.Current.Company, q.Value, includeInactive: inactive))); break; } } return Task.FromResult(coll); }, operationType: OperationType.Read, statusCode: HttpStatusCode.OK, alternateStatusCode: HttpStatusCode.NoContent)); }
public IActionResult GetNamed() { return(new WebApiGet <ReferenceDataMultiCollection>(this, async() => { var coll = new ReferenceDataMultiCollection(); var inactive = this.IncludeInactive(); var refSelection = this.ReferenceDataSelection(); var names = refSelection.Select(x => x.Key).ToArray(); await RefDataNamespace.ReferenceData.Current.PrefetchAsync(names).ConfigureAwait(false); foreach (var q in refSelection) { switch (q.Key) { case var s when string.Compare(s, nameof(RefDataNamespace.OpenStatus), StringComparison.InvariantCultureIgnoreCase) == 0: coll.Add(new ReferenceDataMultiItem(nameof(RefDataNamespace.OpenStatus), await ReferenceDataFilterer.ApplyFilterAsync <RefDataNamespace.OpenStatusCollection, RefDataNamespace.OpenStatus>(RefDataNamespace.ReferenceData.Current.OpenStatus, q.Value, includeInactive: inactive).ConfigureAwait(false))); break; case var s when string.Compare(s, nameof(RefDataNamespace.ProductCategory), StringComparison.InvariantCultureIgnoreCase) == 0: coll.Add(new ReferenceDataMultiItem(nameof(RefDataNamespace.ProductCategory), await ReferenceDataFilterer.ApplyFilterAsync <RefDataNamespace.ProductCategoryCollection, RefDataNamespace.ProductCategory>(RefDataNamespace.ReferenceData.Current.ProductCategory, q.Value, includeInactive: inactive).ConfigureAwait(false))); break; case var s when string.Compare(s, nameof(RefDataNamespace.AccountUType), StringComparison.InvariantCultureIgnoreCase) == 0: coll.Add(new ReferenceDataMultiItem(nameof(RefDataNamespace.AccountUType), await ReferenceDataFilterer.ApplyFilterAsync <RefDataNamespace.AccountUTypeCollection, RefDataNamespace.AccountUType>(RefDataNamespace.ReferenceData.Current.AccountUType, q.Value, includeInactive: inactive).ConfigureAwait(false))); break; case var s when string.Compare(s, nameof(RefDataNamespace.MaturityInstructions), StringComparison.InvariantCultureIgnoreCase) == 0: coll.Add(new ReferenceDataMultiItem(nameof(RefDataNamespace.MaturityInstructions), await ReferenceDataFilterer.ApplyFilterAsync <RefDataNamespace.MaturityInstructionsCollection, RefDataNamespace.MaturityInstructions>(RefDataNamespace.ReferenceData.Current.MaturityInstructions, q.Value, includeInactive: inactive).ConfigureAwait(false))); break; case var s when string.Compare(s, nameof(RefDataNamespace.TransactionType), StringComparison.InvariantCultureIgnoreCase) == 0: coll.Add(new ReferenceDataMultiItem(nameof(RefDataNamespace.TransactionType), await ReferenceDataFilterer.ApplyFilterAsync <RefDataNamespace.TransactionTypeCollection, RefDataNamespace.TransactionType>(RefDataNamespace.ReferenceData.Current.TransactionType, q.Value, includeInactive: inactive).ConfigureAwait(false))); break; case var s when string.Compare(s, nameof(RefDataNamespace.TransactionStatus), StringComparison.InvariantCultureIgnoreCase) == 0: coll.Add(new ReferenceDataMultiItem(nameof(RefDataNamespace.TransactionStatus), await ReferenceDataFilterer.ApplyFilterAsync <RefDataNamespace.TransactionStatusCollection, RefDataNamespace.TransactionStatus>(RefDataNamespace.ReferenceData.Current.TransactionStatus, q.Value, includeInactive: inactive).ConfigureAwait(false))); break; } } return coll; }, operationType: OperationType.Read, statusCode: HttpStatusCode.OK, alternateStatusCode: HttpStatusCode.NoContent));