using Biskilog_Accounting.Shared.CustomModels;
using Biskilog_Accounting.Shared.Interfaces;
using Biskilog_Accounting.Shared.POSModels;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
namespace Biskilog_Accounting.Server.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class SalesController : ControllerBase
{
private readonly ISalesInterface m_salesService;
public SalesController(ISalesInterface a_salesService)
{
m_salesService = a_salesService;
}
///
/// Endpoint to return Sales within a specified period
///
///
///
[Authorize]
[HttpGet, Route("transactions/{a_start}/{a_end}")]
public IEnumerable GetSalesAsync(DateTime a_start, DateTime a_end)
{
return m_salesService.GetTransactions(a_start, a_end);
}
///
/// Endpoint to return Sales using the specified transaction id
///
[Authorize]
[HttpGet, Route("transactions/lookup/{a_receipt}")]
public IEnumerable GetSaleAsync(string a_receipt)
{
return m_salesService.GetReceipt(a_receipt);
}
///
/// Endpoint to return receipt details
///
[Authorize]
[HttpGet, Route("receipt/lookup/{a_receipt}")]
public IEnumerable GetReceiptAsync(string a_receipt)
{
return m_salesService.GetReceiptDetail(a_receipt).Result.ToList();
}
}
}