Example #1
0
        public List <AuditLogEntryDTO> Handle(GetAuditEntriesQuery query)
        {
            var auditLogs = _auditLogEntryRepository.Get(query);
            var users     = _userRepository.GetAll();

            var rs = auditLogs.Join(users, x => x.UserId, y => y.Id,
                                    (x, y) => new AuditLogEntryDTO
            {
                UserId          = x.UserId,
                Action          = x.Action,
                ObjectId        = x.ObjectId,
                Log             = x.Log,
                CreatedDateTime = x.CreatedDateTime,
                UserName        = y.UserName,
            });

            return(rs.OrderByDescending(x => x.CreatedDateTime).ToList());
        }
Example #2
0
        public async Task <List <AuditLogEntryDTO> > HandleAsync(GetAuditEntriesQuery query, CancellationToken cancellationToken = default)
        {
            var auditLogs = _auditLogEntryRepository.Get(query);
            var users     = _userRepository.GetAll();

            var rs = auditLogs.Join(users, x => x.UserId, y => y.Id,
                                    (x, y) => new AuditLogEntryDTO
            {
                Id              = x.Id,
                UserId          = x.UserId,
                Action          = x.Action,
                ObjectId        = x.ObjectId,
                Log             = x.Log,
                CreatedDateTime = x.CreatedDateTime,
                UserName        = y.UserName,
            });

            return(await _userRepository.ToListAsync(rs.OrderByDescending(x => x.CreatedDateTime)));
        }