Exemple #1
0
        //[Produces("application/json", "application/problem+json")]
        public async Task <IActionResult> GetUsersByConcert(Guid id)
        {
            var concert = await _concertsRepository.GetConcertAsync(id);

            if (concert == null)
            {
                return(NotFound());
            }

            var users = await _concertsRepository.GetUsersOfConcertAsync(concert.ConcertId);

            var result = Mapper.Map <IEnumerable <UserDto> >(users);

            return(Ok(result));
        }
Exemple #2
0
        public async Task <IActionResult> GetUsersByConcert(Guid id)
        {
            var concert = await _concertsRepository.GetConcertAsync(id);

            if (concert == null)
            {
                return(NotFound());
            }

            var users = await _concertsRepository.GetUsersOfConcertAsync(concert.ConcertId);

            var results = Mapper.Map <IEnumerable <UserDto> >(users);

            var response = new HALResponse(concert)
                           .AddLinks(new Link("self", $"/core/v1/concerts/{id}"))
                           .AddEmbeddedCollection("user", results,
                                                  new Link[] {
                new Link("self", "/core/v1/users/{UserId}")
            });

            return(Ok(response));
        }