Exemple #1
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            DjSong = await _context.DjSongs
                     .Include(d => d.Dj)
                     .Include(d => d.Song).FirstOrDefaultAsync(m => m.DjSongId == id);

            if (DjSong == null)
            {
                return(NotFound());
            }
            return(Page());
        }
Exemple #2
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            DjSong = await _context.DjSongs.FindAsync(id);

            if (DjSong != null)
            {
                _context.DjSongs.Remove(DjSong);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            DjSong = await _context.DjSongs
                     .Include(d => d.Dj)
                     .Include(d => d.Song).FirstOrDefaultAsync(m => m.DjSongId == id);

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

            DJSelectList   = new SelectList(_context.Djs, nameof(Dj.DjId), nameof(Dj.StageName));
            SongSelectList = new SelectList(_context.Songs, nameof(Song.SongId), nameof(Song.SongName));
            return(Page());
        }