public async Task <IActionResult> Edit(int id, [Bind("AthleteId,AthleteName,TestId,Distance,MyProperty")] TestDetails testDetails) { if (id != testDetails.AthleteId) { return(NotFound()); } if (ModelState.IsValid) { try { testDetails.MyProperty = this.checkFitness(testDetails.Distance); _context.Update(testDetails); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TestDetailsExists(testDetails.AthleteId)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index", "TestDetails", new { id = testDetails.TestId })); } return(View(testDetails)); }
public async Task <IActionResult> Edit(int id, [Bind("TestId,Date,NumOfParticipants,TestType")] Test test) { if (id != test.TestId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(test); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TestExists(test.TestId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(test)); }