using AsbCloudApp.Data; using AsbCloudApp.Repositories; using AsbCloudDb.Model; using Mapster; using Microsoft.EntityFrameworkCore; using System.Threading; using System.Threading.Tasks; namespace AsbCloudInfrastructure.Repository; public class HelpPageRepository : CrudRepositoryBase, IHelpPageRepository { public HelpPageRepository(IAsbCloudDbContext context) : base(context) { } public async Task GetOrDefaultByUrlPageAndIdCategoryAsync(string key, int idCategory, CancellationToken cancellationToken) { var helpPage = await dbSet.AsNoTracking() .SingleOrDefaultAsync(x => x.UrlPage == key && x.IdCategory == idCategory, cancellationToken); if (helpPage is null) return null; return helpPage.Adapt(); } public Task IsExistingAsync(string key, int idCategory, CancellationToken cancellationToken) => dbContext.HelpPages.AnyAsync(h => h.UrlPage == key && h.IdCategory == idCategory, cancellationToken); }