Пример #1
0
        public async Task <IActionResult> SearchAsync([FromQuery] MaraphoneInfoSearchQuery infoSearchQuery, CancellationToken cancellationToken)
        {
            if (infoSearchQuery == null)
            {
                var error = ServiceErrorResponses.InvalidQuery("MaraphoneInfoSearchQuery");
                return(this.BadRequest(error));
            }

            var modelMaraphones = await maraphoneRepository.SearchAsync(infoSearchQuery, cancellationToken);

            var clientMaraphones     = modelMaraphones.Select(MaraphoneConverter.Convert).ToList();
            var clientMaraphonesList = new MaraphoneList
            {
                Maraphones = clientMaraphones
            };

            return(Ok(clientMaraphonesList));
        }
Пример #2
0
        public async Task <IActionResult> SearchAsync([FromQuery] Client.ActivityInfoSearchQuery infoSearchQuery, CancellationToken cancellationToken)
        {
            if (infoSearchQuery == null)
            {
                var error = ServiceErrorResponses.InvalidQuery("ActivityInfoSearchQuery");
                return(this.BadRequest(error));
            }

            var modelQuery      = ActivitySearchInfoQueryConverter.Convert(infoSearchQuery);
            var modelActivities = await activityRepository.SearchAsync(modelQuery, cancellationToken);

            var clientActivities   = modelActivities.Select(ActivityConverter.Convert).ToList();
            var clientActivityList = new ActivityList
            {
                Activities = clientActivities
            };

            return(Ok(clientActivityList));
        }