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(); }
public IHttpActionResult All() { try { var authorsDto = _authorBLL.List().Select(x => new AuthorDto() { Id = x.Id, FirstName = x.FirstName, LastName = x.LastName, Books = x.Books.Select(y => new BookDto { Id = y.Id, Title = y.Title, Description = y.Description }) }).ToList(); return(Ok(authorsDto)); } catch (Exception ex) { return(StatusCode(HttpStatusCode.InternalServerError)); } }