コード例 #1
0
ファイル: Edit.cshtml.cs プロジェクト: remijarry/DevBetterWeb
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var archiveVideoEntity = await _context.ArchiveVideos.AsNoTracking()
                                     .Include(v => v.Questions)
                                     .FirstOrDefaultAsync(v => v.Id == id);


            if (archiveVideoEntity == null)
            {
                return(NotFound());
            }
            ArchiveVideoModel = new ArchiveVideoEditDTO
            {
                Id          = archiveVideoEntity.Id,
                DateCreated = archiveVideoEntity.DateCreated,
                ShowNotes   = archiveVideoEntity.ShowNotes,
                Title       = archiveVideoEntity.Title,
                VideoUrl    = archiveVideoEntity.VideoUrl
            };

            Questions = archiveVideoEntity.Questions;

            return(Page());
        }
コード例 #2
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var archiveVideoEntity = _repository.GetById <ArchiveVideo>(id.Value);

            if (archiveVideoEntity == null)
            {
                return(NotFound());
            }
            ArchiveVideoModel = new ArchiveVideoEditDTO
            {
                Id          = archiveVideoEntity.Id,
                DateCreated = archiveVideoEntity.DateCreated,
                ShowNotes   = archiveVideoEntity.ShowNotes,
                Title       = archiveVideoEntity.Title,
                VideoUrl    = archiveVideoEntity.VideoUrl
            };
            return(Page());
        }