Files
TicketAppIncrArchi/Controllers/TicketsController.cs

34 lines
714 B
C#

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