Example #1
0
 public void Insert(AuditView model)
 {
     using (var rep = new AuditRepository())
        {
        rep.Insert(ConvertToAudit(model));
        }
 }
Example #2
0
 private static Audit ConvertToAudit(AuditView modelView)
 {
     var dev = new Audit
        {
        AuditID = modelView.AuditID,
        UserName = modelView.UserName,
        Event = modelView.Event,
        TimeAccessed = modelView.TimeAccessed,
        };
        return dev;
 }
Example #3
0
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            //Stores the Request in an Accessible object
            var request = filterContext.HttpContext.Request;

            //Generate an audit
            AuditView audit = new AuditView()
            {
                AuditID = Guid.NewGuid(),
                Event = request.RawUrl,
                TimeAccessed = DateTime.UtcNow,
                UserName = (request.IsAuthenticated) ? filterContext.HttpContext.User.Identity.Name : "Anonymous",
            };

            //Stores the Audit in the Database
            _auditRecords.Insert(audit);
            base.OnActionExecuting(filterContext);
        }