public async Task <Terminal> Get(Guid guid, Graph.Common.NeuronQuery neuronQuery, CancellationToken cancellationToken = default(CancellationToken)) { Terminal result = null; NeuronRepository.FillWithDefaults(neuronQuery, this.settingsService); using (var db = ArangoDatabase.CreateWithSetting(this.settingsService.DatabaseName)) { AssertionConcern.AssertStateTrue(await Helper.GraphExists(db), Constants.Messages.Error.GraphNotInitialized); var t = await db.DocumentAsync <Terminal>(guid.ToString()); if ( t != null && ( neuronQuery.TerminalActiveValues.Value.HasFlag(Graph.Common.ActiveValues.All) || ( Helper.TryConvert(neuronQuery.TerminalActiveValues.Value, out bool activeValue) && t.Active == activeValue ) ) ) { result = t.CloneExcludeSynapticPrefix(); } } return(result); }
internal static Graph.Common.NeuronQuery ToExternalType(this NeuronQuery value) { var result = new Graph.Common.NeuronQuery(); result.Id = value.Id?.ToArray(); result.IdNot = value.IdNot?.ToArray(); result.Postsynaptic = value.Postsynaptic?.ToArray(); result.PostsynapticNot = value.PostsynapticNot?.ToArray(); result.Presynaptic = value.Presynaptic?.ToArray(); result.PresynapticNot = value.PresynapticNot?.ToArray(); result.TagContains = value.TagContains?.ToArray(); result.TagContainsNot = value.TagContainsNot?.ToArray(); result.TagContainsIgnoreWhitespace = value.TagContainsIgnoreWhitespace; result.RegionId = value.RegionId?.ToArray(); result.RegionIdNot = value.RegionIdNot?.ToArray(); result.ExternalReferenceUrl = value.ExternalReferenceUrl?.ToArray(); result.ExternalReferenceUrlContains = value.ExternalReferenceUrlContains?.ToArray(); result.RelativeValues = Extensions.ConvertNullableEnumToExternal <RelativeValues, Graph.Common.RelativeValues>( value.RelativeValues, v => ((int)v).ToString() ); result.NeuronActiveValues = Extensions.ConvertNullableEnumToExternal <ActiveValues, Graph.Common.ActiveValues>( value.NeuronActiveValues, v => ((int)v).ToString() ); result.TerminalActiveValues = Extensions.ConvertNullableEnumToExternal <ActiveValues, Graph.Common.ActiveValues>( value.TerminalActiveValues, v => ((int)v).ToString() ); result.Page = value.Page; result.PageSize = value.PageSize; result.SortBy = Extensions.ConvertNullableEnumToExternal <SortByValue, Graph.Common.SortByValue>( value.SortBy, v => ((int)v).ToString() ); result.SortOrder = Extensions.ConvertNullableEnumToExternal <SortOrderValue, Graph.Common.SortOrderValue>( value.SortOrder, v => ((int)v).ToString() ); return(result); }