New source control repo for Biskilog POS - secure hub to store & manage source code. Streamlines dev process, tracks changes, & improves collaboration. Ensures reliable software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
1.7 KiB

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;
}
/// <summary>
/// Endpoint to return Sales within a specified period
/// </summary>
/// <param name="a_start"></param>
/// <param name="a_end"></param>
[Authorize]
[HttpGet, Route("transactions/{a_start}/{a_end}")]
public IEnumerable<SaleItem> GetSalesAsync(DateTime a_start, DateTime a_end)
{
return m_salesService.GetTransactions(a_start, a_end);
}
/// <summary>
/// Endpoint to return Sales using the specified transaction id
/// </summary>
[Authorize]
[HttpGet, Route("transactions/lookup/{a_receipt}")]
public IEnumerable<SaleItem> GetSaleAsync(string a_receipt)
{
return m_salesService.GetReceipt(a_receipt);
}
/// <summary>
/// Endpoint to return receipt details
/// </summary>
[Authorize]
[HttpGet, Route("receipt/lookup/{a_receipt}")]
public IEnumerable<Tblcart> GetReceiptAsync(string a_receipt)
{
return m_salesService.GetReceiptDetail(a_receipt).Result.ToList();
}
}
}