many bug fixes and features added
This commit is contained in:
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user