public IActionResult OnGet()
        {
            ViewData["RecordLabelID"] = new SelectList(_context.Set <RecordLabel>(), "ID", "RLName");

            var album = new Album();

            album.AlbumGenres = new List <AlbumGenre>();
            PopulateAssignedGenreData(_context, album);
            return(Page());
        }
Esempio n. 2
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Album = await _context.Album
                    .Include(b => b.RecordLabel)
                    .Include(b => b.AlbumGenres).ThenInclude(b => b.Genre)
                    .AsNoTracking()
                    .FirstOrDefaultAsync(m => m.ID == id);

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

            PopulateAssignedGenreData(_context, Album);

            ViewData["RecordLabelID"] = new SelectList(_context.Set <RecordLabel>(), "ID", "RLName");
            return(Page());
        }