Exemple #1
0
        public IActionResult Get([FromRoute] string id)
        {
            var dispatcherResponse = _publisherServiceDispatcher.RouteToPublisher(id);

            var response = new GetPublisherHttpResponse
            {
                Total = dispatcherResponse.Total, Publishers = dispatcherResponse.Publishers.Select(
                    t => new PublisherModel
                {
                    Id = t.Id, Name = t.Name, Series = t.Series
                })
            };

            return(StatusCode((int)HttpStatusCode.OK, response));
        }
        public IActionResult Get([FromRoute] string id)
        {
            var serviceResponse = _publisherService.Select(id);

            var response = new GetPublisherHttpResponse
            {
                Total = serviceResponse.Total, PublisherCollection =
                    serviceResponse.Publishers.SelectMany(
                        publisher => new List <object>
                {
                    new
                    {
                        publisher.Id, publisher.Name, publisher.Series
                    }
                })
            };

            return(StatusCode((int)HttpStatusCode.OK, response));
        }
Exemple #3
0
        public IActionResult Get([FromQuery] GetAuthorHttpRequest request)
        {
            var dispatcherResponse = _publisherServiceDispatcher.RouteToPublishers(new GetPublisherDispatcherRequest()
            {
                Limit  = request.Limit,
                Offset = request.Offset
            });

            var response = new GetPublisherHttpResponse
            {
                Total = dispatcherResponse.Total, Publishers = dispatcherResponse.Publishers.Select(
                    t => new PublisherModel
                {
                    Id = t.Id, Name = t.Name, Series = t.Series
                })
            };

            return(StatusCode((int)HttpStatusCode.OK, response));
        }
        public IActionResult Get([FromQuery] GetPublisherHttpRequest request)
        {
            var serviceResponse = _publisherService.SelectAll(request.Offset, request.Limit);

            var response = new GetPublisherHttpResponse
            {
                Total = serviceResponse.Total, PublisherCollection =
                    serviceResponse.Publishers.SelectMany(
                        publisher => new List <object>
                {
                    new
                    {
                        publisher.Id, publisher.Name, publisher.Series
                    }
                })
            };

            return(StatusCode((int)HttpStatusCode.OK, response));
        }