Exemplo n.º 1
0
        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));
        }
Exemplo n.º 2
0
        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));
        }
Exemplo n.º 3
0
        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));
        }