public async Task<ActionResult> Details(int id) { var model = new ConferenceDetailsViewModel(); //1. First fetch the conference details form the database. using (var db = new ConferenceContext()) { var conference = db.Conferences.FirstOrDefault(c => c.Id == id); if (conference != null) model.Conference = conference; } try { var conf = await Getconference(model.Conference.ConferenceId.ToString()).Get(); // store the participants in the result model model.Participants = conf.Participants; } catch (Exception) { model.Participants = new IParticipant[0]; //do nothing, just means no one is in the conference } return View(model); }
public async Task<ViewResult> Details(Guid id) { var model = new ConferenceDetailsViewModel(); using (var db = new ConferenceContext()) { var conference = db.Conferences.FirstOrDefault(m => m.OwnerId == User.Identity.Name && m.ConferenceId == id); model.Conference = conference; try { var conf = await Getconference(conference.ConferenceId.ToString()).Get(); // store the participants in the result model if (conf != null) { model.Participants = conf.Participants; } else { model.Participants = new IParticipant[0]; } } catch (Exception) {} return View(model); } }