Beispiel #1
0
        /// <inheritdoc />
        async Task <IDictionaryRange <Guid, DynamicEventName> > IRepository <Guid, DynamicEventName> .FindAllAsync(CancellationToken cancellationToken)
        {
            IEventNameRepository self = this;
            var request = new DynamicEventNameRequest
            {
                Culture = self.Culture
            };
            var response = await this.serviceClient.SendAsync <ICollection <EventNameDTO> >(request, cancellationToken).ConfigureAwait(false);

            if (response.Content == null)
            {
                return(new DictionaryRange <Guid, DynamicEventName>(0));
            }

            var dynamicEventNames = new DictionaryRange <Guid, DynamicEventName>(response.Content.Count)
            {
                SubtotalCount = response.Content.Count,
                TotalCount    = response.Content.Count
            };

            foreach (var dynamicEventName in this.dynamicEventNameCollectionConverter.Convert(response.Content, null))
            {
                dynamicEventName.Culture = request.Culture;
                dynamicEventNames.Add(dynamicEventName.EventId, dynamicEventName);
            }

            return(dynamicEventNames);
        }
Beispiel #2
0
        /// <inheritdoc />
        IDictionaryRange <Guid, DynamicEventName> IRepository <Guid, DynamicEventName> .FindAll()
        {
            IEventNameRepository self = this;
            var request = new DynamicEventNameRequest
            {
                Culture = self.Culture
            };
            var response = this.serviceClient.Send <ICollection <EventNameDTO> >(request);

            if (response.Content == null)
            {
                return(new DictionaryRange <Guid, DynamicEventName>(0));
            }

            var dynamicEventNames = new DictionaryRange <Guid, DynamicEventName>(response.Content.Count)
            {
                SubtotalCount = response.Content.Count,
                TotalCount    = response.Content.Count
            };

            foreach (var dynamicEventName in this.dynamicEventNameCollectionConverter.Convert(response.Content, null))
            {
                dynamicEventName.Culture = request.Culture;
                dynamicEventNames.Add(dynamicEventName.EventId, dynamicEventName);
            }

            return(dynamicEventNames);
        }
        /// <inheritdoc />
        Task <IDictionaryRange <Guid, DynamicEventName> > IRepository <Guid, DynamicEventName> .FindAllAsync(CancellationToken cancellationToken)
        {
            IEventNameRepository self = this;
            var request = new DynamicEventNameRequest
            {
                Culture = self.Culture
            };
            var responseTask = this.serviceClient.SendAsync <ICollection <EventNameDataContract> >(request, cancellationToken);

            return(responseTask.ContinueWith(task => this.ConvertAsyncResponse(task, request.Culture), cancellationToken));
        }