Esempio n. 1
0
        private BookResultDto MapModelToBookResultDto(Book book)
        {
            var bookDto = new BookResultDto()
            {
                Id          = book.Id,
                Name        = book.Name,
                Description = book.Description,
                PublishDate = book.PublishDate,
                Value       = book.Value,
                CategoryId  = book.CategoryId
            };

            return(bookDto);
        }
Esempio n. 2
0
        private List <BookResultDto> MapModelToBookResultListDto(List <Book> books)
        {
            var listBooks = new List <BookResultDto>();

            foreach (var item in books)
            {
                var book = new BookResultDto()
                {
                    Id          = item.Id,
                    Name        = item.Name,
                    Description = item.Description,
                    PublishDate = item.PublishDate,
                    Value       = item.Value,
                    CategoryId  = item.CategoryId
                };
                listBooks.Add(book);
            }

            return(listBooks);
        }