using AutobusApi.Application.Common.Models; using AutobusApi.Application.TicketGroups.Commands.CreateTicketGroup; using AutobusApi.Application.TicketGroups.Commands.DeleteTicketGroup; using AutobusApi.Application.TicketGroups.Commands.UpdateTicketGroup; using AutobusApi.Application.TicketGroups.Queries; using AutobusApi.Application.TicketGroups.Queries.GetTicketGroupsWithPagination; using AutobusApi.Application.TicketGroups.Queries.GetTicketGroup; using Microsoft.AspNetCore.Mvc; namespace AutobusApi.Api.Controllers; [Route("ticketgroups")] public class TicketGroupController : BaseController { [HttpPost] public async Task Create([FromBody] CreateTicketGroupCommand command, CancellationToken cancellationToken) { return await Mediator.Send(command, cancellationToken); } [HttpGet] public async Task> GetPage([FromQuery] GetTicketGroupsWithPaginationQuery query, CancellationToken cancellationToken) { return await Mediator.Send(query, cancellationToken); } [HttpGet("{id}")] public async Task Get(int id, /* [FromQuery] GetTicketGroupQuery query, */ CancellationToken cancellationToken) { var query = new GetTicketGroupQuery() { Id = id }; return await Mediator.Send(query, cancellationToken); } [HttpPut] public async Task Update([FromBody] UpdateTicketGroupCommand command, CancellationToken cancellationToken) { await Mediator.Send(command, cancellationToken); } [HttpDelete("{id}")] public async Task Delete(int id, /* [FromBody] DeleteTicketGroupCommand command, */ CancellationToken cancellationToken) { var command = new DeleteTicketGroupCommand() { Id = id }; await Mediator.Send(command, cancellationToken); } }