many bug fixes and features added

This commit is contained in:
2026-06-27 12:15:37 -04:00
parent f60174625e
commit 78dbbc2051
51 changed files with 1459 additions and 124 deletions

View File

@@ -2,6 +2,7 @@ using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using SportsDivision.Application.DTOs;
using SportsDivision.Application.Interfaces;
using SportsDivision.Domain.Enums;
namespace SportsDivision.Web.Controllers;
@@ -28,6 +29,13 @@ public class HighJumpController : Controller
[HttpGet]
public async Task<IActionResult> Index(int tournamentEventLevelId)
{
if (tournamentEventLevelId <= 0)
{
ViewBag.ScoringTargets = await _tournamentService.GetEventLevelsByCategoryAsync(EventCategory.HighJump);
ViewBag.ScoringController = "HighJump";
ViewBag.ScoringTitle = "High Jump Scoring";
return View("SelectEventLevel");
}
var heights = await _highJumpService.GetHeightsAsync(tournamentEventLevelId);
var registrations = await _registrationService.GetByTournamentEventLevelAsync(tournamentEventLevelId);
ViewBag.TournamentEventLevelId = tournamentEventLevelId;
@@ -57,12 +65,11 @@ public class HighJumpController : Controller
}
[HttpPost]
public async Task<IActionResult> RecordAttempt([FromBody] HighJumpAttemptUpdateDto dto)
[ValidateAntiForgeryToken]
public async Task<IActionResult> RecordAttempt(HighJumpAttemptUpdateDto dto, int tournamentEventLevelId)
{
await _highJumpService.RecordAttemptAsync(dto);
var isEliminated = await _highJumpService.IsEliminatedAsync(
dto.HighJumpHeightId, dto.EventRegistrationId);
return Json(new { success = true, isEliminated });
return RedirectToAction(nameof(Index), new { tournamentEventLevelId });
}
[HttpPost]