Browse Source
Add FindTitleAsync to IPageRepository
pull/18782/head
Enis Necipoglu
2 years ago
No known key found for this signature in database
GPG Key ID: 1EC55E13241E1680
3 changed files with
13 additions and
0 deletions
-
modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Pages/IPageRepository.cs
-
modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Pages/EfCorePageRepository.cs
-
modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Pages/MongoPageRepository.cs
|
|
|
@ -24,4 +24,6 @@ public interface IPageRepository : IBasicRepository<Page, Guid> |
|
|
|
Task<bool> ExistsAsync(string slug, CancellationToken cancellationToken = default); |
|
|
|
|
|
|
|
Task<List<Page>> GetListOfHomePagesAsync(CancellationToken cancellationToken = default); |
|
|
|
|
|
|
|
Task<string?> FindTitleAsync(Guid pageId, CancellationToken cancellationToken = default); |
|
|
|
} |
|
|
|
|
|
|
|
@ -68,4 +68,9 @@ public class EfCorePageRepository : EfCoreRepository<ICmsKitDbContext, Page, Gui |
|
|
|
{ |
|
|
|
return GetListAsync(x => x.IsHomePage, cancellationToken: GetCancellationToken(cancellationToken)); |
|
|
|
} |
|
|
|
|
|
|
|
public async Task<string?> FindTitleAsync(Guid pageId, CancellationToken cancellationToken = default) |
|
|
|
{ |
|
|
|
return await (await GetDbSetAsync()).Where(x => x.Id == pageId).Select(x => x.Title).FirstOrDefaultAsync(cancellationToken); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -76,4 +76,10 @@ public class MongoPageRepository : MongoDbRepository<ICmsKitMongoDbContext, Page |
|
|
|
{ |
|
|
|
return GetListAsync(x => x.IsHomePage, cancellationToken: GetCancellationToken(cancellationToken)); |
|
|
|
} |
|
|
|
|
|
|
|
public async Task<string> FindTitleAsync(Guid pageId, CancellationToken cancellationToken = default) |
|
|
|
{ |
|
|
|
return await (await GetMongoQueryableAsync(cancellationToken)).Where(x => x.Id == pageId).Select(x => x.Title) |
|
|
|
.FirstOrDefaultAsync(cancellationToken); |
|
|
|
} |
|
|
|
} |
|
|
|
|