Пример #1
0
 // GET: Events
 /// <summary>
 ///     Displays a list of upcoming events
 /// </summary>
 /// <returns>
 ///     Index view with all upcoming events
 /// </returns>
 public async Task<ActionResult> Index()
 {
     var model = new EventListViewModel
     {
         Events = await db.Events
             .Where(e => e.Date >= DateTime.Today)
             .OrderBy(e => e.Date).ToListAsync(),
         OnlyRegisteredEvents = false
     };
     return View(model);
 }
Пример #2
0
        public async Task<ActionResult> MyEvents()
        {
            Member currentMember = await db.Members.FindAsync(idGetter.GetUserId(User.Identity));

            var model = new EventListViewModel
            {
                Events = currentMember.RegisteredEvents
                    .Where(e => e.Date >= DateTime.Today)
                    .OrderBy(e => e.Date),
                OnlyRegisteredEvents = true
            };

            return View("Index", model);
        }