public async Task <IActionResult> Edit(string id, [Bind("TeeBoxId,GolfCourseId,Name,MensSlope,MensCourseRating,WomensSlope,WomensCourseRating,UnitOfMeasure")] TeeBox teeBox) { if (id != teeBox.TeeBoxId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(teeBox); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TeeBoxExists(teeBox.TeeBoxId)) { return(NotFound()); } else { throw; } } //return RedirectToAction(nameof(Index)); return(RedirectToAction(nameof(Details), "GolfCourses", new { id = teeBox.GolfCourseId })); } return(View(teeBox)); }
public async Task <IActionResult> Create([Bind("TeeBoxId,GolfCourseId,Name,MensSlope,MensCourseRating,WomensSlope,WomensCourseRating,UnitOfMeasure")] TeeBox teeBox) { if (ModelState.IsValid) { _context.Add(teeBox); await _context.SaveChangesAsync(); //return RedirectToAction(nameof(Index)); return(RedirectToAction(nameof(Create), "Holes", new { teeBoxId = teeBox.TeeBoxId })); //Continue to define holes } return(View(teeBox)); }