예제 #1
0
        public async Task <IActionResult> List(AuditTrailListViewModel model)
        {
            if (ModelState.IsValid)
            {
                model.Items = await _db.AuditTrails.Where(at => (
                                                              (model.ListFrom.HasValue ? (at.Created >= model.ListFrom) : true) &&
                                                              (model.ListTo.HasValue ? (at.Created <= model.ListTo) : true)))
                              .ToListAsync();

                ApplicationUser currentUser = await _userManager.GetUserAsync(User);

                await _auditTrailService.CreateAuditTrailAsync(_db, currentUser, "AuditTrail list", "AuditTrailController.List");
            }

            return(View(model));
        }