public async Task <IActionResult> Edit(int id, [Bind("ID,WorkoutTime,WorkoutName,WorkoutWeight,WorkoutReps,WorkoutSets")] WorkoutData workoutData) { if (id != workoutData.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(workoutData); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!WorkoutDataExists(workoutData.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(workoutData)); }
public async Task <IActionResult> Edit(int id, [Bind("ID,Date,Distance,Time,RunType")] Running running) { if (id != running.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(running); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!RunningExists(running.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(running)); }