コード例 #1
0
ファイル: BookBLLTest.cs プロジェクト: Lemasternel/BookStore
        public BookBLLTest()
        {
            var repo = new Repository();

            publisherBLL = new PublisherBLL(repo);
            authorBLL    = new AuthorBLL(repo);
            bookBLL      = new BookBLL(repo);

            author    = authorBLL.List().FirstOrDefault();
            publisher = publisherBLL.List().FirstOrDefault();
        }
コード例 #2
0
        public IHttpActionResult All()
        {
            try
            {
                var publishersDto = _publisherBLL.List().Select(x => new PublisherDto {
                    Id    = x.Id,
                    Name  = x.Name,
                    Books = x.Books.Select(y => new BookDto {
                        Id          = y.Id,
                        Title       = y.Title,
                        Description = y.Description
                    })
                }).ToList();

                return(Ok(publishersDto));
            }
            catch (Exception ex)
            {
                return(StatusCode(HttpStatusCode.InternalServerError));
            }
        }