Ejemplo n.º 1
0
        public async Task <IActionResult> Edit(Guid id, [Bind("Id,SpotifyId,Name,Duration,SourceTrackId,AlbumId")] Track track)
        {
            if (id != track.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(track);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TrackExists(track.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                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));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Edit(Guid id,
                                               [Bind("Id,AlbumName,ArtistNames,Dirty,ListenTime,Popularity,TrackId,TrackName,SourceOf,TrackSpotifyId,ArtistSpotifyIds,AlbumSpotifyId,TrackDuration,AlbumImage")] Play play)
        {
            if (id != play.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(play);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PlayExists(play.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["TrackId"] = new SelectList(_context.Track, "Id", "Name", play.TrackId);
            return(View(play));
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> Edit(Guid id, [Bind("Id,SpotifyId,Name")] Artist artist)
        {
            if (id != artist.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(artist);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ArtistExists(artist.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(artist));
        }