private static string GetIncludeProperties(UsersToEventRelatedData includes) { string includeProperties = ""; switch (includes) { case UsersToEventRelatedData.None: break; case UsersToEventRelatedData.Events: includeProperties = @"Event"; break; default: break; } return(includeProperties); }
public static List <UsersToEvent> GetPagedUsersToEventsByUserID(int userID, int pageNumber, int pageSize = int.MaxValue, UsersToEventRelatedData relatedData = UsersToEventRelatedData.None) { using (IUnitOfWork unitOfWork = new cmiUnitOfWork()) { Repository <UsersToEvent> repository = new Repository <UsersToEvent>(unitOfWork); List <UsersToEvent> events = repository.Get(e => e.UserID == userID && e.Event.StartTime > DateTime.Today, GetIncludeProperties(relatedData)).OrderBy(e => e.Event.StartTime).ToPagedList(pageNumber, pageSize).ToList(); return(events); } }