Advertisement
Guest User

Untitled

a guest
Mar 19th, 2019
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using EduitorNetCore.Models.Database;
  5. using EduitorNetCore.Models.VOs.Reduceds;
  6. using EduitorNetCore.Repositories.Database;
  7. using EduitorNetCore.Repositories.Interfaces;
  8. using Microsoft.EntityFrameworkCore;
  9.  
  10. namespace EduitorNetCore.Repositories
  11. {
  12. public class CategoryRepository : Repository<Category>, ICategoryRepository
  13. {
  14. public CategoryRepository(DataBaseContext context) : base(context) { }
  15.  
  16. public IEnumerable<Category> GetAllIncludeInCategoriesId(IEnumerable<int> categoryIds)
  17. {
  18. return Context.Categories.Where(c => categoryIds.Contains(c.Id));
  19. }
  20.  
  21. // we need to use this GetAll method
  22. public IEnumerable<Category> GetAllWithRelatedEntities() => Context.Categories.Include(c => c.Resources);
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement