예제 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,UserId")] Playlist playlist)
        {
            if (id != playlist.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(playlist);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PlaylistExists(playlist.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["UserId"] = new SelectList(_context.User, "Id", "DisplayName", playlist.UserId);
            return(View(playlist));
        }
예제 #2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Release_Date,Genre,ImageLink,AlbumLink,ArtistId")] Album album)
        {
            if (id != album.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(album);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AlbumExists(album.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ArtistId"] = new SelectList(_context.Artist, "Id", "Name", album.ArtistId);
            return(View(album));
        }
예제 #3
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Genre,ImageLink,ArtistLink")] 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));
        }
예제 #4
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,ArtistId,Date,Lat,Long,Country,City,AddressName,Description")] Concert concert)
        {
            if (id != concert.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(concert);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ConcertExists(concert.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ArtistId"] = new SelectList(_context.Artist, "Id", "Id", concert.ArtistId);
            return(View(concert));
        }
예제 #5
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,CounterPlayed,LinkToPlay,AlbumId")] Song song)
        {
            if (id != song.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(song);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SongExists(song.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["AlbumId"] = new SelectList(_context.Set <Album>(), "Id", "Name", song.AlbumId);
            return(View(song));
        }
예제 #6
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Username,Password,ConfirmPassword,UserType")] Admin admin)
        {
            if (id != admin.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(admin);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AdminExists(admin.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(admin));
        }
예제 #7
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,PlaylistId,SongId")] SongToPlaylist songToPlaylist)
        {
            if (id != songToPlaylist.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(songToPlaylist);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SongToPlaylistExists(songToPlaylist.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["PlaylistId"] = new SelectList(_context.Playlist, "Id", "Name", songToPlaylist.PlaylistId);
            ViewData["SongId"]     = new SelectList(_context.Song, "Id", "Name", songToPlaylist.SongId);
            return(View(songToPlaylist));
        }