public async Task <ActionResult> Index(string channelId) { var accessToken = await AadHelper.GetAccessToken(); var repo = new VideoChannelRepository(accessToken); var channel = await repo.GetChannel(channelId); var videos = await repo.GetChannelVideos(channelId); var viewModel = new VideoListViewModel { ChannelId = channelId, ChannelTitle = channel.Title, Videos = videos }; return(View(viewModel)); }
public async Task <ActionResult> Index(string channelId) { try { var accessTokenSharePoint = await AadHelper.GetAccessTokenForSharePoint(); var accessTokenMSGraph = await AadHelper.GetAccessTokenForMicrosoftGraph(); var sharePointRepository = new VideoChannelRepository(accessTokenSharePoint); var groupsRepository = new GroupsRepository(graphClient); var subscriptionsRepository = new SubscriptionsRepository(graphClient, this.Session, HttpRuntime.Cache); var channel = await sharePointRepository.GetChannel(channelId); var videos = await sharePointRepository.GetChannelVideos(channelId); var groups = await groupsRepository.GetGroups(); var viewModel = new VideoListViewModel { ChannelId = channelId, ChannelTitle = channel.Title, Videos = videos, Groups = groups }; // integration of the webhooks example Microsoft.Graph.Subscription result = await subscriptionsRepository.CreateOrReuseSubscription(); return(View(viewModel)); } catch (Exception ex) { if (ex is AdalException) { // let the ActionFilterAttribute take care of it throw ex; } return(RedirectToAction("Index", "Error", new { message = ex.Message })); } }
public async Task <ActionResult> EventDetails(string EventId) { var accessTokenSharePoint = await AadHelper.GetAccessTokenForSharePoint(); var repoSP = new VideoChannelRepository(accessTokenSharePoint); //OLD MOD tenant //string channelId = "037b317f-2fcf-451a-a618-99dfb45aa2f1"; //TODO Retrieve from schema extension string channelId = "7710364b-6748-49ef-9a47-002240b994fd"; var viewmodel = new EventDetailsViewModel { Event = await managedEventRepository.GetManagedEventById(EventId), Videos = await repoSP.GetChannelVideos(channelId), GroupCalendarEvents = await managedEventRepository.GetGroupCalendarEvents(EventId), BudgetStatus = await managedEventRepository.GetBudgetFromExcelsheet(EventId, SettingsHelper.drive_path_to_excelsheet), PlanningStatus = "Good" }; return(View(viewmodel)); }