public async Task <IActionResult> Edit(int id, [Bind("ID,SongID,Created")] History history) { if (id != history.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(history); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!HistoryExists(history.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["SongID"] = new SelectList(_context.Songs, "ID", "ID", history.SongID); return(View(history)); }
public async Task <IActionResult> Edit(int id, [Bind("ID,Artist,Title,Bpm,Key,Intensity,Year,Disc,Track,Genre")] 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))); } return(View(song)); }