Create Audits on Actions
This commit is contained in:
@@ -46,6 +46,8 @@ namespace FoodsharingSiegen.Server.Data.Service
|
||||
|
||||
await Context.SaveChangesAsync();
|
||||
|
||||
await AuditService.Insert(AuditType.AddInteraction, targetProspect.Name, interaction.Type.ToString());
|
||||
|
||||
// Detatch entities
|
||||
Context.Entry(targetProspect).State = EntityState.Detached;
|
||||
Context.Entry(interaction).State = EntityState.Detached;
|
||||
@@ -130,6 +132,8 @@ namespace FoodsharingSiegen.Server.Data.Service
|
||||
Context.Interactions.Remove(new Interaction { Id = interactionId });
|
||||
await Context.SaveChangesAsync();
|
||||
|
||||
await AuditService.Insert(AuditType.RemoveInteraction, "?");
|
||||
|
||||
return new OperationResult();
|
||||
}
|
||||
catch (Exception e)
|
||||
@@ -161,6 +165,8 @@ namespace FoodsharingSiegen.Server.Data.Service
|
||||
var saveR = await Context.SaveChangesAsync();
|
||||
|
||||
if(saveR < 1) return new OperationResult(new Exception("Fehler beim speichern"));
|
||||
|
||||
await AuditService.Insert(AuditType.EditProspect, prospect.Name);
|
||||
return new OperationResult();
|
||||
}
|
||||
catch (Exception e)
|
||||
|
||||
Reference in New Issue
Block a user