public static async Task AddOtherEventAsync(this IAuditLogRepository auditRepo, string clientId, string eventRecord, string changer) { var auditRecord = new AuditLogData { EventRecord = eventRecord, CreatedTime = DateTime.UtcNow, RecordType = AuditRecordType.OtherEvent, Changer = changer }; await auditRepo.InsertRecord(clientId, auditRecord); }
public static async Task AddAuditRecordAsync <T>(this IAuditLogRepository auditRepo, string clientId, T objBefore, T objAfter, AuditRecordType type, string changer) { var auditRecord = new AuditLogData { BeforeJson = objBefore != null?objBefore.ToJson() : null, AfterJson = objAfter != null?objAfter.ToJson() : null, CreatedTime = DateTime.UtcNow, RecordType = type, Changer = changer }; await auditRepo.InsertRecord(clientId, auditRecord); }