public async Task <IActionResult> OnGetAsync(int?id, int?startTime = null) { if (id == null) { return(NotFound()); } StartTime = startTime; var archiveVideoEntity = await _context.ArchiveVideos .Include(v => v.Questions) .FirstOrDefaultAsync(m => m.Id == id); if (archiveVideoEntity == null) { return(NotFound()); } string videoUrl = _configuration["videoUrlPrefix"] + archiveVideoEntity.VideoUrl; ArchiveVideoDetails = new ArchiveVideoDetailsDTO { DateCreated = archiveVideoEntity.DateCreated, ShowNotes = archiveVideoEntity.ShowNotes, Title = archiveVideoEntity.Title, VideoUrl = videoUrl, Id = archiveVideoEntity.Id }; ArchiveVideoDetails.Questions.AddRange( archiveVideoEntity.Questions .Select(q => new QuestionViewModel { QuestionText = q.QuestionText, TimestampSeconds = q.TimestampSeconds })); return(Page()); }
public async Task <IActionResult> OnGetAsync(int?id, int?startTime = null) { if (id == null) { return(NotFound()); } StartTime = startTime; var spec = new ArchiveVideoWithQuestionsSpec(id.Value); var archiveVideoEntity = await _repository.GetBySpecAsync(spec); if (archiveVideoEntity == null) { return(NotFound()); } string videoUrl = _configuration["videoUrlPrefix"] + archiveVideoEntity.VideoUrl; ArchiveVideoDetails = new ArchiveVideoDetailsDTO { DateCreated = archiveVideoEntity.DateCreated, ShowNotes = archiveVideoEntity.ShowNotes, Title = archiveVideoEntity.Title, VideoUrl = videoUrl, Id = archiveVideoEntity.Id }; ArchiveVideoDetails.Questions.AddRange( archiveVideoEntity.Questions .Select(q => new QuestionViewModel { QuestionText = q.QuestionText, TimestampSeconds = q.TimestampSeconds })); return(Page()); }