LSFE/LSFE.Domain/Services/ErrorLogger.cs
2026-07-30 10:31:04 +08:00

32 lines
842 B
C#

using LSFE.Domain.Contracts.Doctor;
using LSFE.Infrastructure.Database;
using LSFE.Infrastructure.Entities;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LSFE.Domain.Services
{
public interface IErrorLogger
{
Task LogErrorAsync(ErrorLogs error);
}
public class ErrorLogger : GenericRepository<Infrastructure.Entities.ErrorLogs>, IErrorLogger
{
private readonly LSFEDbContext _context;
public ErrorLogger(LSFEDbContext context) : base(context)
{
_context = context;
}
public async Task LogErrorAsync(ErrorLogs error)
{
await _dbContext.AddAsync(error);
await _dbContext.SaveChangesAsync();
}
}
}