public async Task <IActionResult> Create([Bind("ArtistId,ArtistName,YearEstablished")] Artist artist)
        {
            if (ModelState.IsValid)
            {
                _context.Add(artist);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(artist));
        }
示例#2
0
        public async Task <IActionResult> Create([Bind("AlbumId,Title")] Album album)
        {
            if (ModelState.IsValid)
            {
                _context.Add(album);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(album));
        }