forked from ddrilling/AsbCloudServer
35 lines
925 B
C#
35 lines
925 B
C#
|
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<HelpPageDto, HelpPage>,
|
|||
|
IHelpPageRepository
|
|||
|
{
|
|||
|
public HelpPageRepository(IAsbCloudDbContext context)
|
|||
|
: base(context)
|
|||
|
{
|
|||
|
}
|
|||
|
|
|||
|
public async Task<HelpPageDto?> GetOrDefaultByUrlPageAndIdCategoryAsync(string urlPage,
|
|||
|
int idCategory,
|
|||
|
CancellationToken cancellationToken)
|
|||
|
{
|
|||
|
var helpPage = await dbSet.AsNoTracking()
|
|||
|
.SingleOrDefaultAsync(x =>
|
|||
|
x.UrlPage == urlPage &&
|
|||
|
x.IdCategory == idCategory,
|
|||
|
cancellationToken);
|
|||
|
|
|||
|
if (helpPage is null)
|
|||
|
return null;
|
|||
|
|
|||
|
return helpPage.Adapt<HelpPageDto>();
|
|||
|
}
|
|||
|
}
|