public bool CreateBook(List <int> authorsId, List <int> categoriesId, Book book) { var authors = _bookDbContext.Authors.Where(a => authorsId.Contains(a.Id)).ToList(); var categories = _bookDbContext.Categories.Where(c => categoriesId.Contains(c.Id)).ToList(); foreach (var author in authors) { var bookAuthor = new BookAuthor() { Author = author, Book = book }; _bookDbContext.Add(bookAuthor); } foreach (var category in categories) { var bookCategory = new BookCategory() { Category = category, Book = book }; _bookDbContext.Add(bookCategory); } _bookDbContext.Add(book); return(Save()); }
public bool CreateReviewer(Reviewer reviewer) { _reviewerDbContext.Add(reviewer); return(Save()); }
public bool CreateReview(Review review) { _reviewDbContext.Add(review); return(Save()); }
public bool CreateAuthor(Author author) { _authorRepository.Add(author); return(Save()); }
public bool CreateAuthor(Author author) { _authorContext.Add(author); return(Save()); }
public bool CreateCategory(Category category) { _categoryContext.Add(category); return(Save()); }
public bool CreateCountry(Country country) { _countryContext.Add(country); return(Save()); }