public async Task <IActionResult> Create([Bind("Id,Name,WebSite")] Producer producer)
        {
            if (ModelState.IsValid)
            {
                _context.Add(producer);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(producer));
        }
Beispiel #2
0
        public async Task <IActionResult> Create([Bind("Id,Name,Established")] MusicBand musicBand)
        {
            if (ModelState.IsValid)
            {
                _context.Add(musicBand);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(musicBand));
        }
        public async Task <IActionResult> Create([Bind("Id,AlbumName,ReleaseDate")] Album album)
        {
            if (ModelState.IsValid)
            {
                _context.Add(album);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(album));
        }
Beispiel #4
0
        public async Task <IActionResult> Create([Bind("Id,Title,AlbumId,MusicBandId,ProducerId")] Song song)
        {
            if (ModelState.IsValid)
            {
                _context.Add(song);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["AlbumId"]     = new SelectList(_context.Album, "Id", "Id", song.AlbumId);
            ViewData["MusicBandId"] = new SelectList(_context.MusicBand, "Id", "Id", song.MusicBandId);
            ViewData["ProducerId"]  = new SelectList(_context.Producer, "Id", "Id", song.ProducerId);
            return(View(song));
        }