Exemple #1
0
        public async Task <IEnumerable <StoryDto> > Handle(GetStoriesQuery request, CancellationToken cancellationToken)
        {
            var stories = await _storyRepository.GetAsync();

            var storiesDto = stories.Select(x => new StoryDto {
                Id = x.Id, Text = x.Text, Images = x.Images
            });

            return(storiesDto);
        }
Exemple #2
0
        public async Task <IActionResult> GetStories()
        {
            var command = new GetStoriesQuery();

            return(Ok(await _Mediator.Send(command)));
        }
Exemple #3
0
        public async Task <IEnumerable <SimpleStoryDetail> > Handle(GetStoriesQuery request, CancellationToken cancellationToken = default)
        {
            var stories = await _StoryRepository.GetStories();

            return(_Mapper.Map <IEnumerable <SimpleStoryDetail> >(stories));
        }
        public async Task <IActionResult> Get([FromQuery] GetStoriesQuery query)
        {
            var stories = await Mediator.Send(query);

            return(Ok(stories));
        }