using Api.Services.Interfaces; using Common.Dtos.Season; using Common.Dtos.Student; using Microsoft.AspNetCore.Mvc; using System.Reflection; namespace Api.Controllers; [ApiController] public class SeasonController(ISeasonService service) : ControllerBase { private readonly ISeasonService _service = service; [HttpPost] [Route("admin/season/create")] public async Task CreateAsync([FromBody] CreateSeasonRequest request) { var result = await _service.CreateAsync(request); return result.Ok ? Ok(result.CreateSeasonResult) : Conflict(result.Error); } [HttpGet] [Route("admin/season")] public async Task GetAllAsync() { var result = await _service.GetAllAsync(); return result.Length != 0 ? Ok(result) : NoContent(); } [HttpGet] [Route("admin/season/paged")] public async Task GetAllPagedAsync([FromQuery] GetSeasonsRequest request) { var result = await _service.GetAllPagedAsync(request); return Ok(result); } }