-
-
Notifications
You must be signed in to change notification settings - Fork 323
/
AuditAction.cs
65 lines (61 loc) · 2.38 KB
/
AuditAction.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#if ASP_CORE
using Microsoft.AspNetCore.Mvc.Filters;
#endif
using System.Collections.Generic;
using Audit.Core;
using System.Text.Json.Serialization;
namespace Audit.Mvc
{
public class AuditAction : IAuditOutput
{
public string TraceId { get; set; }
public string HttpMethod { get; set; }
public string ControllerName { get; set; }
public string ActionName { get; set; }
public string ViewName { get; set; }
public string ViewPath { get; set; }
public IDictionary<string, string> FormVariables { get; set; }
public IDictionary<string, object> ActionParameters { get; set; }
public BodyContent RequestBody { get; set; }
public BodyContent ResponseBody { get; set; }
public string UserName { get; set; }
public string RequestUrl { get; set; }
public string IpAddress { get; set; }
public string ResponseStatus { get; set; }
public int ResponseStatusCode { get; set; }
public IDictionary<string, string> Headers { get; set; }
public object Model { get; set; }
public bool? ModelStateValid { get; set; }
public IDictionary<string, string> ModelStateErrors { get; set; }
public string RedirectLocation { get; set; }
public string Exception { get; set; }
[JsonExtensionData]
public Dictionary<string, object> CustomFields { get; set; } = new Dictionary<string, object>();
#if ASP_CORE
[JsonIgnore]
internal PageHandlerExecutingContext PageHandlerExecutingContext { get; set; }
/// <summary>
/// Gets the ActionExecutingContext related to this event
/// </summary>
public PageHandlerExecutingContext GetPageHandlerExecutingContext()
{
return PageHandlerExecutingContext;
}
#endif
/// <summary>
/// Serializes this Audit Action as a JSON string
/// </summary>
public string ToJson()
{
return Configuration.JsonAdapter.Serialize(this);
}
/// <summary>
/// Parses an Audit Action from its JSON string representation.
/// </summary>
/// <param name="json">JSON string with the Entity Audit Action representation.</param>
public static AuditAction FromJson(string json)
{
return Configuration.JsonAdapter.Deserialize<AuditAction>(json);
}
}
}