Files
sanstudent/Api/Controllers/SeasonController.cs
aherman-san b8f03bf6d3
All checks were successful
SanStudent Multi-Project Deployment / deploy-api (push) Successful in 41s
SanStudent Multi-Project Deployment / deploy-frontadmin (push) Successful in 41s
SanStudent Multi-Project Deployment / deploy-frontstudent (push) Successful in 40s
Add project
2026-03-07 11:14:26 +01:00

38 lines
1.0 KiB
C#

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<ActionResult> 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<ActionResult> GetAllAsync()
{
var result = await _service.GetAllAsync();
return result.Length != 0 ? Ok(result) : NoContent();
}
[HttpGet]
[Route("admin/season/paged")]
public async Task<ActionResult> GetAllPagedAsync([FromQuery] GetSeasonsRequest request)
{
var result = await _service.GetAllPagedAsync(request);
return Ok(result);
}
}