public CategoriesBooksAuthorsDTO GetAllTables() { CategoriesBooksAuthorsDTO categoriesBooksAvtors = new CategoriesBooksAuthorsDTO(); categoriesBooksAvtors.Books = _booksContext.Books.ToList(); categoriesBooksAvtors.Authors = _booksContext.Avtors.ToList(); categoriesBooksAvtors.Categories = _booksContext.Categories.ToList(); categoriesBooksAvtors.Comments = _booksContext.Comments.ToList(); return(categoriesBooksAvtors); }
public CategoriesBooksAuthorsDTO GetAllTables() { var categoriesBooksAuthors = new CategoriesBooksAuthorsDTO(); var sql = @" select * from Books select * from Avtors select * from Comments select * from categories"; using (SqlMapper.GridReader multi = _connectionString.QueryMultiple(sql)) { categoriesBooksAuthors.Books = multi.Read <Book>().ToList(); categoriesBooksAuthors.Authors = multi.Read <Author>().ToList(); categoriesBooksAuthors.Categories = multi.Read <Category>().ToList(); categoriesBooksAuthors.Comments = multi.Read <Comment>().ToList(); } return(categoriesBooksAuthors); }