public async Task <IActionResult> Edit(int id, [Bind("Id,Name")] Workout workout) { if (id != workout.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(workout); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!WorkoutExists(workout.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(workout)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Password")] User user) { if (id != user.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(user); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!UserExists(user.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(user)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Date,Sets,Repetitions,Weight")] HistoryItem historyItem) { if (id != historyItem.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(historyItem); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!HistoryItemExists(historyItem.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(historyItem)); }