using AutobusApi.Application.Common.Models; using AutobusApi.Application.VehicleEnrollments.Commands.CreateVehicleEnrollment; using AutobusApi.Application.VehicleEnrollments.Commands.DeleteVehicleEnrollment; using AutobusApi.Application.VehicleEnrollments.Commands.UpdateVehicleEnrollment; using AutobusApi.Application.VehicleEnrollments.Queries; using AutobusApi.Application.VehicleEnrollments.Queries.GetVehicleEnrollmentsWithPagination; using AutobusApi.Application.VehicleEnrollments.Queries.GetVehicleEnrollment; using Microsoft.AspNetCore.Mvc; namespace AutobusApi.Api.Controllers; [Route("vehicleenrollments")] public class VehicleEnrollmentController : BaseController { [HttpPost] public async Task Create([FromBody] CreateVehicleEnrollmentCommand command, CancellationToken cancellationToken) { return await Mediator.Send(command, cancellationToken); } [HttpGet] public async Task> GetPage([FromQuery] GetVehicleEnrollmentsWithPaginationQuery query, CancellationToken cancellationToken) { return await Mediator.Send(query, cancellationToken); } [HttpGet("{id}")] public async Task Get(int id, /* [FromQuery] GetVehicleEnrollmentQuery query, */ CancellationToken cancellationToken) { var query = new GetVehicleEnrollmentQuery() { Id = id }; return await Mediator.Send(query, cancellationToken); } [HttpPut] public async Task Update([FromBody] UpdateVehicleEnrollmentCommand command, CancellationToken cancellationToken) { await Mediator.Send(command, cancellationToken); } [HttpDelete("{id}")] public async Task Delete(int id, /* [FromBody] DeleteVehicleEnrollmentCommand command, */ CancellationToken cancellationToken) { var command = new DeleteVehicleEnrollmentCommand() { Id = id }; await Mediator.Send(command, cancellationToken); } }