public async Task <IActionResult> Create([Bind("TestId,Date,TestType")] Test test) { if (ModelState.IsValid) { _context.Add(test); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(test)); }
public async Task <IActionResult> Create([Bind("AthleteName,Distance")] TestDetails testDetails, int id) { testDetails.TestId = id; if (ModelState.IsValid) { testDetails.MyProperty = this.checkFitness(testDetails.Distance); _context.Add(testDetails); await _context.SaveChangesAsync(); return(RedirectToAction("Index", "TestDetails", new { id = testDetails.TestId })); } return(View(testDetails)); }