Example #1
0
 public async Task <Ad> FindByIdWithUserInclude(int id, CancellationToken cancellationToken)
 {
     return(await DbСontext
            .Set <Ad>()
            .Include(a => a.Owner)
            .FirstOrDefaultAsync(a => a.Id == id, cancellationToken));
 }
Example #2
0
 public async Task <Ad> FindByIdWithUserAndCategory(int id, CancellationToken cancellationToken)
 {
     return(await DbСontext
            .Set <Ad>()
            .Include(a => a.Owner)
            .Include(a => a.Category)
            .Include(a => a.Category.ChildCategories)
            .Include(a => a.Category.ParentCategory)
            .AsNoTracking()
            .FirstOrDefaultAsync(a => a.Id == id, cancellationToken));
 }