//////////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> Get the EventUsers by EventId </summary> /// <remarks> Andre Beging, 27.04.2018. </remarks> /// <param name="context"> The context to act on. </param> /// <param name="eventId"> Identifier for the event. </param> /// <returns> The event users. </returns> //////////////////////////////////////////////////////////////////////////////////////////////////// public static IQueryable <User> GetEventUsers(this BierAlyzerContext context, Guid eventId) { return(context.Event .Where(u => u.EventId == eventId) .SelectMany(u => u.EventUsers) .Select(ue => ue.User)); }
//////////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> Get the UserEvents by UserId </summary> /// <remarks> Andre Beging, 27.04.2018. </remarks> /// <param name="context"> The context to act on. </param> /// <param name="userId"> Identifier for the user. </param> /// <returns> The user events. </returns> //////////////////////////////////////////////////////////////////////////////////////////////////// public static IQueryable <Event> GetUserEvents(this BierAlyzerContext context, Guid userId) { return(context.User .Where(u => u.UserId == userId) .SelectMany(u => u.UserEvents) .Select(ue => ue.Event) .Where(e => e.Type != EventType.Hidden)); }
//////////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> Constructor. </summary> /// <remarks> Andre Beging, 18.11.2018. </remarks> /// <param name="context"> The context. </param> /// <param name="mapper"> The mapper. </param> //////////////////////////////////////////////////////////////////////////////////////////////////// public EventService(BierAlyzerContext context, IMapper mapper) : base(context, mapper) { }