public async Task <IActionResult> Create([Bind("SpotifyId,Name")] Artist artist) { if (ModelState.IsValid) { artist.Id = Guid.NewGuid(); _context.Add(artist); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(artist)); }
public async Task <IActionResult> Create( [Bind("AlbumName,ArtistNames,Dirty,ListenTime,Popularity,TrackId,TrackName,SourceOf,TrackSpotifyId,ArtistSpotifyIds,AlbumSpotifyId,TrackDuration,AlbumImage")] Play play) { if (ModelState.IsValid) { play.Id = Guid.NewGuid(); _context.Add(play); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["TrackId"] = new SelectList(_context.Track, "Id", "Name", play.TrackId); return(View(play)); }
public async Task <IActionResult> Create([Bind("SpotifyId,Name,Duration,SourceTrackId,AlbumId")] Track track) { if (ModelState.IsValid) { track.Id = Guid.NewGuid(); _context.Add(track); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["AlbumId"] = new SelectList(_context.Album, "Id", "Name", track.AlbumId); ViewData["SourceTrackId"] = new SelectList(_context.Track, "Id", "Name", track.SourceTrackId); return(View(track)); }