Beispiel #1
0
        protected ActionResult <ApiResponses <ResponseDto> > GetAll(
            IReaderGetAll <DataModel> readerGetAll,
            IMapper mapper)
        {
            var responseDtos = readerGetAll
                               .GetAll()
                               .Select(mapper.Map <ResponseDto>)
                               .ToList();
            var responseDto = new ApiResponses <ResponseDto>
            {
                Elements = responseDtos
            };

            return(Ok(responseDto));
        }
Beispiel #2
0
        protected ActionResult <HALResponse> GetAll(
            IReaderGetAll <DataModel> readerGetAll,
            IMapper mapper,
            IHalService <ResponseDto> halService)
        {
            var halResponses = readerGetAll
                               .GetAll()
                               .Select(dataModel =>
            {
                var responseDto = mapper.Map <ResponseDto>(dataModel);

                return(halService.AddLinks(responseDto));
            })
                               .ToList();
            var halResponse = halService.AddLinks(halResponses);

            return(Ok(halResponse));
        }