コード例 #1
0
 internal bool CheckIfUserIsParticipant(int userId, int eventId)
 {
     if (ParticipantsInEvent.Where(p => p.UserId == userId && p.EventId == eventId).Count() > 0)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
コード例 #2
0
        internal List <User> GetUsersByEventId(int id)
        {
            var participants = ParticipantsInEvent.Where(e => e.EventId == id).ToList();
            var users        = new List <User>();

            foreach (var participant in participants)
            {
                users.Add(User.Where(u => u.Id == participant.UserId).First());
            }
            return(users);
        }
コード例 #3
0
        public Event GetEventById(int id)
        {
            var myEvent = Event.Where(e => e.Id == id).First();

            myEvent.ParticipantsInEvent = ParticipantsInEvent.Where(p => p.EventId == myEvent.Id).ToList();

            myEvent.StandardCurrency = Currency.Where(c => c.Id == myEvent.StandardCurrencyId).FirstOrDefault();

            myEvent.Expense = Expense.Where(e => e.EventId == myEvent.Id).ToList();

            foreach (var expense in myEvent.Expense)
            {
                expense.PayersForExpense = PayersForExpense.Where(p => p.ExpenseId == expense.Id).ToList();
            }

            foreach (var person in myEvent.ParticipantsInEvent)
            {
                person.User = User.Where(u => u.Id == person.UserId).First();
            }

            return(myEvent);
        }
コード例 #4
0
        public List <Event> GetInactiveEventsByUserId(int id)
        {
            var myEvents = ParticipantsInEvent.Where(p => p.UserId == id && p.Event.IsActive == false).Select(p => p.Event).ToList();

            return(myEvents);
        }