insight/src/Core/Insight.Infrastructure/Services/AgentService.cs
2023-09-21 18:58:32 +02:00

36 lines
No EOL
1.3 KiB
C#

using Insight.Infrastructure.Entities;
using Insight.Infrastructure.Models;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
using MongoDB.Driver;
namespace Insight.Infrastructure.Services
{
public class AgentService
{
private readonly IMongoDatabase _database;
private readonly ILogger<AgentService> _logger;
public AgentService(IMongoDatabase database, ILogger<AgentService> logger)
{
_database = database;
_logger = logger;
}
public Task<PagedList<AgentEntity>> GetAsync(
FilterDefinition<AgentEntity>? filter = null,
SortDefinition<AgentEntity>? sort = null,
int offset = 0,
int limit = 10,
CancellationToken cancellationToken = default) => _database.Agent().GetPagedAsync(filter, sort, offset, limit, cancellationToken);
public Task<PagedList<AgentEntity>> GetAsync(
HttpRequest request,
HttpResponse response,
FilterDefinition<AgentEntity>? filter = null,
SortDefinition<AgentEntity>? sort = null,
int offset = 0,
int limit = 10,
CancellationToken cancellationToken = default) => _database.Agent().GetPagedAsync(request, response, filter, sort, offset, limit, cancellationToken);
}
}