public async Task <IActionResult> GetStories([FromQuery] StoryParameters storyParameters)
        {
            var getAllStoriesQuery = new GetAllStoriesQuery(storyParameters);
            var result             = await mediator.Send(getAllStoriesQuery);

            if (result.Code == HttpStatusCode.OK)
            {
                Response.Headers.Add("X-Pagination", PagedList <Entity> .ToJson(result.Value as PagedList <Entity>));
            }

            return(StatusCode((int)result.Code, result.Value));
        }
Ejemplo n.º 2
0
        public async Task <List <StoryDto> > Handle(GetAllStoriesQuery request, CancellationToken cancellationToken)
        {
            var result = await _unitOfWork.Stories.GetAll();

            return(_mapper.Map <List <StoryDto> >(result.ToList()));
        }