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 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)); } }