mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-05-25 10:22:26 +00:00
27 lines
No EOL
703 B
C#
27 lines
No EOL
703 B
C#
#nullable enable
|
|
using System.Threading.Tasks;
|
|
using LBPUnion.ProjectLighthouse.Types;
|
|
using LBPUnion.ProjectLighthouse.Types.Levels;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace LBPUnion.ProjectLighthouse.Controllers.Api;
|
|
|
|
public class GetSlotEndpoint : ApiEndpoint
|
|
{
|
|
private readonly Database database;
|
|
|
|
public GetSlotEndpoint(Database database)
|
|
{
|
|
this.database = database;
|
|
}
|
|
|
|
[HttpGet("slot/{id:int}")]
|
|
public async Task<IActionResult> OnGet(int id)
|
|
{
|
|
Slot? slot = await this.database.Slots.FirstOrDefaultAsync(u => u.SlotId == id);
|
|
if (slot == null) return this.NotFound();
|
|
|
|
return this.Ok(slot);
|
|
}
|
|
} |