private List <CategoryBook> CreateManyToManyRelationships(int bookId, RepositoryFactory repositoryFactory) { List <CategoryBook> categoryBooks = repositoryFactory.GetCategoryBookRepository() .GetModels() .Where(b => b.BookId == bookId) .ToList(); foreach (var item in categoryBooks) { repositoryFactory.GetCategoryBookRepository().DeleteManyToMany(item); } return(CategoryIds .Select(catId => new CategoryBook { BookId = bookId, CategoryId = catId }) .ToList()); }
private List <Models.CategorySpot> CreateManyToManyRelationships(int spotId, RepositoryFactory repositoryFactory) { List <Models.CategorySpot> categorySpots = repositoryFactory.GetCategorySpotRepository() .GetModels() .Where(s => s.SpotId == spotId) .ToList(); foreach (var item in categorySpots) { repositoryFactory.GetCategorySpotRepository().DeleteManyToMany(item); } return(CategoryIds .Select(catId => new Models.CategorySpot { SpotId = spotId, CategoryId = catId }) .ToList()); }
private List <CategoryRestaurant> CreateManyToManyRelationships(int restaurantId) { return(CategoryIds.Select(catId => new CategoryRestaurant { RestaurantId = restaurantId, CategoryId = catId }).ToList()); }
private List <CategoryLocation> CreateManyToManyRelationships(int locationId) { return(CategoryIds.Select(catId => new CategoryLocation { LocationId = locationId, CategoryId = catId }).ToList()); }
private List <Models.CategorySpot> CreateManyToManyRelationships(int spotId) { return(CategoryIds.Select(catId => new Models.CategorySpot { SpotId = spotId, CategoryId = catId }).ToList()); }
private List <CategoryBook> CreateManyToManyRelationships(int bookId) { return(CategoryIds.Select(catId => new CategoryBook { BookId = bookId, CategoryId = catId }).ToList()); }