Пример #1
0
        public IActionResult Get(string searchValue, int pageSize, int skip, int take, string sortField, string dir)
        {
            try
            {
                var loggedUser = UserHelper.CurrentUserGuid(HttpContext);
                var result     = _auditLogService.GetAll(searchValue, pageSize, skip, take, sortField, dir);

                var lstAuditLog = result.Select(x => new AuditLog
                {
                    AuditLogGuid       = x.AuditLogGuid,
                    TimeStamp          = x.TimeStamp,
                    Resource           = x.Resource,
                    ResourceId         = x.ResourceId,
                    Actor              = x.Actor,
                    ActorId            = x.ActorId,
                    IpAddress          = x.IpAddress,
                    Action             = x.Action,
                    ActionId           = x.ActionId,
                    ActionResult       = x.ActionResult,
                    ActionResultReason = x.ActionResultReason,
                    //AdditionalInformation = string.Format("<a href=\"{0}\">{1}</a>", x.AdditionalInformationURl, x.AdditionalInformation),
                    AdditionalInformation    = string.IsNullOrEmpty(x.AdditionalInformationURl) ? "" : string.Format("<a href=\"{0}\">{1}</a>", x.AdditionalInformationURl, "Click to view affected resource.."),
                    AdditionalInformationURl = x.AdditionalInformationURl
                }).ToList();

                return(Ok(new { result = lstAuditLog, count = _auditLogService.TotalRecord(searchValue) }));
            }
            catch (Exception ex)
            {
                ModelState.Clear();
                ModelState.AddModelError("", ex.Message);
                return(BadRequestFormatter.BadRequest(this, ex));
            }
        }
Пример #2
0
        // GET: AuditLog
        public ActionResult Index(int page)
        {
            IEnumerable <AuditLogViewModel> result = _auditLogService.GetAll().ToPagedList((page == 0) ? 1 : page, 10);

            return(View(result));
        }
Пример #3
0
 public IEnumerable <Models.AuditInfo> Get()
 {
     return(_auditLogService.GetAll());
     //return new string[] { "value1", "value2" };
 }
Пример #4
0
 public IActionResult GetAll()
 {
     var auditLogs = _auditLogService.GetAll();
     var auditLogsDTO = _mapper.Map<IList<AuditLogDto>>(auditLogs);
     return Ok(auditLogsDTO);
 }