Add project
This commit is contained in:
37
Api/Controllers/SeasonController.cs
Normal file
37
Api/Controllers/SeasonController.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
36
Api/Controllers/SpecializationController.cs
Normal file
36
Api/Controllers/SpecializationController.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using Api.Services.Interfaces;
|
||||
using Common.Dtos.Season;
|
||||
using Common.Dtos.Specialization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Api.Controllers;
|
||||
|
||||
[ApiController]
|
||||
public class SpecializationController(ISpecializationService service) : ControllerBase
|
||||
{
|
||||
private readonly ISpecializationService _service = service;
|
||||
|
||||
[HttpPost]
|
||||
[Route("admin/specialization/create")]
|
||||
public async Task<ActionResult> CreateAsync([FromBody] CreateSpecializationRequest request)
|
||||
{
|
||||
var result = await _service.CreateAsync(request);
|
||||
return result.Ok ? Ok(result.CreateSpecializationResult) : Conflict(result.Error);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("admin/specialization")]
|
||||
public async Task<ActionResult> GetAllAsync()
|
||||
{
|
||||
var result = await _service.GetAllAsync();
|
||||
return result.Length != 0 ? Ok(result) : NoContent();
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("admin/specialization/paged")]
|
||||
public async Task<ActionResult> GetAllPagedAsync([FromQuery] GetSpecializationsRequest request)
|
||||
{
|
||||
var result = await _service.GetAllPagedAsync(request);
|
||||
return Ok(result);
|
||||
}
|
||||
}
|
||||
36
Api/Controllers/SubjectController.cs
Normal file
36
Api/Controllers/SubjectController.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using Api.Services.Interfaces;
|
||||
using Common.Dtos.Subject;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Api.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
public class SubjectController(ISubjectService service) : ControllerBase
|
||||
{
|
||||
private readonly ISubjectService _service = service;
|
||||
|
||||
[HttpPost]
|
||||
[Route("admin/subject/create")]
|
||||
public async Task<ActionResult> CreateAsync([FromBody] CreateSubjectRequest request)
|
||||
{
|
||||
var result = await _service.CreateAsync(request);
|
||||
return result.Ok ? Ok(result.CreateSubjectResult) : Conflict(result.Error);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("admin/subject")]
|
||||
public async Task<ActionResult> GetAllAsync()
|
||||
{
|
||||
var result = await _service.GetAllAsync();
|
||||
return result.Length != 0 ? Ok(result) : NoContent();
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("admin/subject/paged")]
|
||||
public async Task<ActionResult> GetAllPagedAsync([FromQuery] GetSubjectsRequest request)
|
||||
{
|
||||
var result = await _service.GetAllPagedAsync(request);
|
||||
return Ok(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
32
Api/Controllers/VersionController.cs
Normal file
32
Api/Controllers/VersionController.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using Api.Extensions;
|
||||
using Api.Services.Interfaces;
|
||||
using Common.Dtos.Student;
|
||||
using Common.Extensions;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Reflection;
|
||||
|
||||
namespace Api.Controllers;
|
||||
|
||||
[ApiController]
|
||||
public class VersionController() : ControllerBase
|
||||
{
|
||||
[HttpGet]
|
||||
[Route("version")]
|
||||
public async Task<ActionResult> GetVersion()
|
||||
{
|
||||
var version = GetVersionNumber();
|
||||
return Ok(version);
|
||||
}
|
||||
|
||||
public static string GetVersionNumber()
|
||||
{
|
||||
var assembly = Assembly.GetExecutingAssembly();
|
||||
var version = new VersionResponse { Version = assembly.GetName().Version!.ToString() };
|
||||
return version.ToJson();
|
||||
}
|
||||
}
|
||||
|
||||
public class VersionResponse
|
||||
{
|
||||
public string Version { get; set; } = string.Empty;
|
||||
}
|
||||
Reference in New Issue
Block a user