Ejemplo n.º 1
0
        /// <inheritdoc />
        Task <Item> IRepository <int, Item> .FindAsync(int identifier, CancellationToken cancellationToken)
        {
            IItemRepository self    = this;
            var             request = new ItemDetailsRequest
            {
                ItemId  = identifier,
                Culture = self.Culture
            };
            var responseTask = this.serviceClient.SendAsync <ItemDataContract>(request, cancellationToken);

            return(responseTask.ContinueWith(
                       task =>
            {
                var item = this.ConvertsAsyncResponse(task);
                item.Culture = request.Culture;
                return item;
            },
                       cancellationToken));
        }
Ejemplo n.º 2
0
        /// <inheritdoc />
        Item IRepository <int, Item> .Find(int identifier)
        {
            IItemRepository self    = this;
            var             request = new ItemDetailsRequest
            {
                ItemId  = identifier,
                Culture = self.Culture
            };
            var response = this.serviceClient.Send <ItemDataContract>(request);

            if (response.Content == null)
            {
                return(null);
            }

            var item = this.converterForItem.Convert(response.Content, null);

            item.Culture = request.Culture;
            return(item);
        }