public async Task <IActionResult> Details(int?id)
        {
            if (!id.HasValue)
            {
                return(NotFound());
            }

            if (!await _sessionBL.SessionExists(id.Value))
            {
                return(NotFound());
            }

            var pageModel = new DetailPageModel();

            pageModel.Session = await _sessionBL.GetSessionViewModels(id.Value, UserId);

            if (pageModel.Session == null)
            {
                return(NotFound());
            }

            pageModel.Speakers = await _speakerBL.GetSpeakersForSession(pageModel.Session.SessionId);

            return(View(pageModel));
        }
예제 #2
0
        public async Task <IActionResult> Details(int?id)
        {
            if (!id.HasValue)
            {
                return(NotFound());
            }

            if (!await _sessionBL.SessionExists(id.Value))
            {
                return(NotFound());
            }

            var session = await _sessionBL.GetSessionViewModel(id.Value);

            if (session == null)
            {
                return(NotFound());
            }

            // Now retrieve the speaker's information for the session
            session.Speakers = await _speakerBL.GetSpeakersForSession(id.Value);

            return(View(session));
        }