Esempio n. 1
0
        public async Task <IActionResult> GetAllHallsAsync(
            [FromHeader(Name = "Accept"), SwaggerParameter(Description = "media type to request between json or json+hateoas")] string mediaType)
        {
            var halls = await _hallRepository.GetAllHallsAsync();

            var mappedHalls = Mapper.Map <IEnumerable <HallDto> >(halls);

            if (mediaType == "application/vnd.biob.json+hateoas")
            {
                return(Ok(CreateLinksForHalls(mappedHalls)));
            }

            return(Ok(mappedHalls));
        }