网站首页 网站源码
website
站点相关全部源代码,隐藏了一些关于服务器的信息
using Dpz.Core.Public.ViewModel.Request;
using Dpz.Core.Public.ViewModel.Response;

namespace Dpz.Core.Service.RepositoryServiceImpl;

public class EmailHistoryService(IRepository<EmailHistory> repository, IMapper mapper)
    : IEmailHistoryService
{
    public async Task AddAsync(AddEmailHistoryRequest request)
    {
        var entity = mapper.Map<EmailHistory>(request);
        await repository.InsertAsync(entity);
    }

    public async Task<IPagedList<EmailHistoryResponse>> GetHistoriesAsync(
        int pageIndex = 1,
        int pageSize = 20
    )
    {
        return await repository
            .MongodbQueryable.OrderByDescending(x => x.Id)
            .ToPagedListAsync<EmailHistory, EmailHistoryResponse>(pageIndex, pageSize);
    }
}
loading