5cb32bee95
This reverts commit 9adfff48a7.
30 lines
841 B
C#
30 lines
841 B
C#
using Microsoft.AspNetCore.Mvc;
|
|
using Distribution.Models;
|
|
|
|
namespace Distribution.Features.Invoice;
|
|
|
|
[ApiController]
|
|
[Route("api/invoices")]
|
|
public class InvoiceController(InvoiceService service) : ControllerBase
|
|
{
|
|
[HttpGet]
|
|
public async Task<IActionResult> GetAll(
|
|
[FromQuery] Guid? agentId,
|
|
[FromQuery] Guid? routeId,
|
|
[FromQuery] Guid? shopId,
|
|
[FromQuery] InvoiceStatus? status,
|
|
[FromQuery] int page = 1,
|
|
[FromQuery] int pageSize = 20)
|
|
{
|
|
var result = await service.GetAllAsync(agentId, routeId, shopId, status, page, pageSize);
|
|
return Ok(result);
|
|
}
|
|
|
|
[HttpGet("{id:guid}")]
|
|
public async Task<IActionResult> GetById(Guid id)
|
|
{
|
|
var result = await service.GetByIdAsync(id);
|
|
return result is null ? NotFound() : Ok(result);
|
|
}
|
|
}
|