Example #1
0
        public ActionResult GetAuthors(Pagination pagination, AuthorFilter authorFilter, string orderBy = "Name")
        {
            var orderByEntities = OrderMapper.MapTo <Author>(orderBy);

            IPagedList <Author> authors = _libraryRepository.GetAuthors(pagination, authorFilter, orderByEntities);
            var authorDtos = _mapper.Map <IEnumerable <AuthorDto> >(authors);

            var result = new
            {
                meta  = authors.GetMetaData(),
                value = authorDtos
            };

            return(Ok(result));
        }
Example #2
0
        public void MapToTest(string orderBy, string expected)
        {
            var mapTo = OrderMapper.MapTo <Author>(orderBy);

            Assert.Equal(expected, mapTo, true);
        }