Ejemplo n.º 1
0
        public async Task <IActionResult> SearchTagsAsync([FromQuery] Client.TagSearchInfo searchInfo,
                                                          CancellationToken cancellationToken)
        {
            cancellationToken.ThrowIfCancellationRequested();

            var modelSearchInfo = Converter.TagSearchInfoConverter.Convert(searchInfo ?? new Client.TagSearchInfo());
            var modelTagsList   = await repository.SearchAsync(modelSearchInfo, cancellationToken).ConfigureAwait(false);

            var clientTagsList = modelTagsList.Select(Converter.TagConverter.Convert).ToImmutableList();

            return(Ok(clientTagsList));
        }
        public static Model.TagSearchInfo Convert(Client.TagSearchInfo clientSearchInfo)
        {
            if (clientSearchInfo == null)
            {
                throw new ArgumentNullException(nameof(clientSearchInfo));
            }

            var modelSearchInfo = new Model.TagSearchInfo
            {
                Offset = clientSearchInfo.Offset,
                Limit  = clientSearchInfo.Limit,
                Tags   = clientSearchInfo.Tag
            };

            return(modelSearchInfo);
        }