You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Ombi/src/Ombi.Store/Repository/AuditRepository.cs

40 lines
981 B

using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using Ombi.Store.Context;
using Ombi.Store.Entities;
namespace Ombi.Store.Repository
{
public class AuditRepository : IAuditRepository
{
public AuditRepository(OmbiContext ctx)
{
Ctx = ctx;
}
private OmbiContext Ctx { get; }
public async Task Record(AuditType type, AuditArea area, string description)
{
await Record(type, area, description, string.Empty);
}
public async Task Record(AuditType type, AuditArea area, string description, string user)
{
await Ctx.Audit.AddAsync(new Audit
{
User = user,
AuditArea = area,
AuditType = type,
DateTime = DateTime.UtcNow,
Description = description
});
await Ctx.SaveChangesAsync();
}
}
}