// ObjectResult<PagedList<Reader>>
        public async Task <ObjectResult> Get(int?page, int?size)
        {
            _logger.LogInformation("Get readers");
            var response = await readerService.GetReaders();

            if (response == null)
            {
                _logger.LogInformation("Internal gateway error");
                return(StatusCode(500, "Internal error"));
            }

            if (response.Code != 200)
            {
                _logger.LogInformation("Can't get readers");
                return(StatusCode(response.Code, response.Message));
            }

            return(GetPagedList(response.Value, page, size));
        }
        public IActionResult Index()
        {
            ReaderListViewModel model = _readerService.GetReaders();

            return(View(model));
        }
Example #3
0
        public ObservableCollection <ReaderModel> GetReaders()
        {
            var res = _service.GetReaders();

            return(new ObservableCollection <ReaderModel>(res.Select(r => _mapper.Map(r))));
        }