예제 #1
0
        public async Task <IActionResult> EventDetails(Guid id)
        {
            if (id == null)
            {
                return(RedirectToAction("Index"));
            }

            var currentUser = await _userManager.GetUserAsync(User);

            var currenEvent = await _eventService.GetSingleEventWithStatus(currentUser.Id, id);

            var userJoined = await _eventService.GetUsersJoined(id);

            var userToAccept = await _eventService.GetUsersToAccept(id);

            var owner = await _eventService.GetOwnerAsync(currenEvent.OwnerId);

            var model = new EventsForDetailsViewModel()
            {
                EventDetailed = currenEvent,
                UsersAccepted = userJoined.ToArray(),
                UsersToAccept = userToAccept.ToArray(),
                Owner         = owner
            };

            return(View(model));
        }