예제 #1
0
        public IActionResult Details(int EventId)
        {
            HostEventsViewModel hostEventsViewModel = new HostEventsViewModel
            {
                HostEvent = _hostEventsRepository.GetHostEvent(EventId),
                Guests    = _guestsRepository.GetAllGuestsForEvent(EventId),
                Gifts     = _giftsRepository.GetAllGiftsForEvent(EventId)
            };

            return(View(hostEventsViewModel));
        }
예제 #2
0
        public List <HostEvent> GetAllEventsAttending(string UserId)
        {
            var AllGuests = _appDbContext.Guests.Where(x => x.UserId == UserId).Where(x => x.IsActive == true).ToList();
            var EventIds  = new List <int>();

            foreach (var guest in AllGuests)
            {
                EventIds.Add(guest.EventId);
            }

            var EventsAttendingList = new List <HostEvent>();

            foreach (var id in EventIds)
            {
                EventsAttendingList.Add(_hostEventsRepository.GetHostEvent(id));
            }

            return(EventsAttendingList);
        }