public async Task <IActionResult> Create([Bind("Id,ArtistId,AlbumName,ReleaseDate,Genre")] Album album) { if (ModelState.IsValid) { await _dataLayerAccess.AddAlbum(album); return(RedirectToAction(nameof(Index), "Artists")); } ViewData["ArtistId"] = new SelectList(_context.Artist, "Id", "ArtistName", album.ArtistId); return(View(album)); }
public async Task <ActionResult <Album> > PostAlbum(Album album) { await _dataAccessLayer.AddAlbum(album); return(CreatedAtAction("GetAlbum", new { id = album.Id }, album)); }