Example #1
0
 public UploadController(IBackendActionLogRepository logger)
 {
     _logger = logger;
 }
Example #2
0
        public static IEnumerable <BackendActionLog> CreateLogs(BackendActionContext actionContext, IBackendActionLogRepository repository)
        {
            var ids    = actionContext.Entities.Where(ent => ent.Id.HasValue).Select(ent => ent.Id.Value).ToArray();
            var titles = repository.GetEntityTitles(actionContext.EntityTypeCode, actionContext.ParentEntityId, ids).ToDictionary(n => n.Value, m => m.Text);

            return(actionContext.Entities
                   .Select(ent => new BackendActionLog
            {
                EntityId = ent.Id,
                EntityStringId = ent.StringId,
                EntityTitle = ent.Id.HasValue && titles.ContainsKey(ent.Id.Value.ToString())
                        ? titles[ent.Id.Value.ToString()].Left(255)
                        : null,
                ActionCode = actionContext.ActionCode,
                ActionTypeCode = actionContext.ActionTypeCode,
                EntityTypeCode = actionContext.EntityTypeCode,
                ParentEntityId = actionContext.ParentEntityId,
                ExecutionTime = DateTime.Now,
                UserId = QPContext.CurrentUserId
            })
                   .ToArray());
        }
Example #3
0
 public override void OnActionExecuting(ActionExecutingContext filterContext)
 {
     _repository = filterContext.HttpContext.RequestServices.GetRequiredService <IBackendActionLogRepository>();
     _logs       = BackendActionLog.CreateLogs(BackendActionContext.Current, _repository);
     base.OnActionExecuting(filterContext);
 }
Example #4
0
 public UploadController(IBackendActionLogRepository logger, FormOptions formOptions)
 {
     _logger      = logger;
     _formOptions = formOptions;
 }
Example #5
0
 public BackendActionLogAttribute()
 {
     Order       = FilterOrder;
     _repository = DependencyResolver.Current.GetService <IBackendActionLogRepository>();
 }