/// <summary> /// Calls the <see cref="EventFilter" />'s internal process function and /// returns its value. /// </summary> /// <returns> /// A value indicating whether the event was successfully processed. /// </returns> /// <param name="e"> /// The <see cref="EventArgs" /> to pass to the underlying process function. /// </param> public bool Process(ref EventArgs e, EventFilterType type) { if (_processAction != null) { return(_processAction(type, ref e)); } return(true); }
public IActionResult Session(Guid sessionId, EventFilterType filterType = EventFilterType.All) { var session = sessionsRepository.Get(sessionId); var allowModify = authTokenHelper.IsAdmin(); IEnumerable <TimelineEventModel> events; switch (filterType) { case EventFilterType.All: events = eventModelBuilder.BuildDateSorted(session.Events, sessionId, allowModify); break; case EventFilterType.Positive: events = eventModelBuilder.BuildPositive(session, allowModify); break; case EventFilterType.Debatable: events = eventModelBuilder.BuildDebatable(session, allowModify); break; case EventFilterType.Negative: events = eventModelBuilder.BuildNegative(session, allowModify); break; case EventFilterType.Discussable: events = eventModelBuilder.BuildToBeDiscussed(session, allowModify); break; default: return(NotFound()); } return(View(new SessionModel { Events = events.ToList(), EventFilterType = filterType, SessionInfo = new SessionInfoModel { SessionId = session.Id, SessionCreateDate = session.CreateDate, SessionName = session.Name } })); }
/// <summary> /// Initializes a new instance of the <see cref="EventFilter" /> class /// with the given process function. /// </summary> /// <param name="processAction"> /// The function to call when the <see cref="Process" /> function is /// called. /// </param> public EventFilter(EventFilterDelegate <EventArgs> processAction, EventFilterType eventType = EventFilterType.All) { _processAction = processAction; EventType = eventType; }
protected EventFilter(EventFilterType eventType) { EventType = eventType; }