feat: default API with ticket

This commit is contained in:
2026-03-13 15:02:59 +01:00
commit 59344ce6a9
8 changed files with 155 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
using Microsoft.AspNetCore.Mvc;
namespace TicketAppIncrArchi.Controllers;
[ApiController]
[Route("api/tickets")]
public class TicketsController : ControllerBase
{
private static List<Ticket> Tickets = new();
[HttpGet]
public IEnumerable<Ticket> Get() => Tickets;
[HttpPost]
public IActionResult Create(Ticket ticket)
{
ticket.Id = Guid.NewGuid();
Tickets.Add(ticket);
return CreatedAtAction(nameof(Get), new {id = ticket.Id}, ticket);
}
public class Ticket
{
public Guid Id {get;set;}
public string Title {get;set;} = "";
public string Description {get;set;} = "";
//public string Status {get;set;} = "";
}
}