Exemple #1
0
        public List <ChangeLog> GetAudit(int id)
        {
            var logs       = new List <ChangeLog>();
            var auditTrail = _auditLog.FindAll(s => s.KeyFieldId == id.ToString()).OrderByDescending(s => s.ActionTime); // we are looking for audit-history of the record selected.

            foreach (var record in auditTrail)
            {
                var change = new ChangeLog
                {
                    ActionBy       = record.ActionBy,
                    ActionTime     = record.ActionTime.ToString(),
                    ActionType     = record.ActionType,
                    ActionTypeName = Enum.GetName(typeof(ActionType), record.ActionType)
                };
                var delta = JsonConvert.DeserializeObject <List <ObjectChangeLog> >(record.ValueChange);
                change.Changes.AddRange(delta);
                logs.Add(change);
            }
            return(logs);
        }