Files
sanstudent/Api/Controllers/VersionController.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

33 lines
764 B
C#

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;
}