// To protect from overposting attacks, enable the specific properties you want to bind to, for
        // more details, see https://aka.ms/RazorPagesCRUD.
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            var emptyMusicnum = new MusicalNum();

            if (await TryUpdateModelAsync <MusicalNum>(
                    emptyMusicnum,
                    "Musicalnum", // Prefix for form value.
                    s => s.ID, s => s.SongID, s => s.Performer))
            {
                _context.MusicalNum.Add(emptyMusicnum);
                await _context.SaveChangesAsync();

                return(RedirectToPage("./Index"));
            }
            // Select DepartmentID if TryUpdateModelAsync fails.

            PopulateSongDropDownList(_context);

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

            MusicalNum = await _context.MusicalNum.FirstOrDefaultAsync(m => m.ID == id);


            if (MusicalNum == null)
            {
                return(NotFound());
            }
            return(Page());
        }
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            MusicalNum = await _context.MusicalNum.FindAsync(id);

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

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

            MusicalNum = await _context.MusicalNum.FirstOrDefaultAsync(m => m.ID == id);

            await _context.Song.ToListAsync();



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

            PopulateSongDropDownList(_context);

            return(Page());
        }