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)); }
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)); }