public UploadController(IBackendActionLogRepository logger) { _logger = logger; }
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()); }
public override void OnActionExecuting(ActionExecutingContext filterContext) { _repository = filterContext.HttpContext.RequestServices.GetRequiredService <IBackendActionLogRepository>(); _logs = BackendActionLog.CreateLogs(BackendActionContext.Current, _repository); base.OnActionExecuting(filterContext); }
public UploadController(IBackendActionLogRepository logger, FormOptions formOptions) { _logger = logger; _formOptions = formOptions; }
public BackendActionLogAttribute() { Order = FilterOrder; _repository = DependencyResolver.Current.GetService <IBackendActionLogRepository>(); }