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.
 
 
 
 

145 lines
5.5 KiB

using Biskilog_Accounting.Shared.CustomModels;
using Biskilog_Accounting.Shared.Interfaces;
using Biskilog_Accounting.Shared.POSModels;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
namespace Biskilog_Accounting.Server.SyncControllers
{
[Route("api/[controller]")]
[ApiController]
public class SyncSalesController : ControllerBase
{
private readonly ISalesInterface m_salesService;
public SyncSalesController(ISalesInterface a_salesService)
{
m_salesService = a_salesService;
}
// GET: api/<SyncSalesController>
[Authorize]
[HttpGet, Route("lastsyncdate/{a_tableName}")]
public DateTime GetLastSyncDate(string a_tableName)
{
return m_salesService.GetLastSyncDate(a_tableName);
}
// Post: api/<SyncSalesController>
[Authorize]
[HttpPost, Route("setsyncdate")]
public void SetLastSyncDate(SyncTimestamp a_timestamp)
{
m_salesService.SetLastSyncDate(a_timestamp.TableName, a_timestamp.Timestamp);
}
// POST api/<SyncSalesController>
/// <summary>
/// Endpoint to publish a collection of TblCart rows to the cloud
/// </summary>
/// <param name="a_item"></param>
[Authorize]
[HttpPost, Route("publish/tblCart")]
public async Task SyncSalesAsync(List<Tblcart> a_item)
{
await m_salesService.SyncCart(a_item);
}
// POST api/<SyncSalesController>
/// <summary>
/// Endpoint to publish a collection of TblCancelledTransation rows to the cloud
/// </summary>
/// <param name="a_item"></param>
[Authorize]
[HttpPost, Route("publish/tblcancelledtransaction")]
public async Task SyncCancelledTransactionAsync(List<Tblcancelledtransaction> a_item)
{
await m_salesService.SyncCancelledTransaction(a_item);
}
// POST api/<SyncSalesController>
/// <summary>
/// Endpoint to publish a collection of TblInvoice rows to the cloud
/// </summary>
/// <param name="a_item"></param>
[Authorize]
[HttpPost, Route("publish/tblinvoice")]
public async Task SyncInvoiceAsync(List<Tblinvoice> a_item)
{
await m_salesService.SyncInvoice(a_item);
}
// POST api/<SyncSalesController>
/// <summary>
/// Endpoint to publish a collection of CreditPurchase rows to the cloud
/// </summary>
/// <param name="a_item"></param>
[Authorize]
[HttpPost, Route("publish/tblCreditpurchase")]
public async Task SyncCreditPurchaseAsync(List<Creditpurchase> a_item)
{
await m_salesService.SyncCreditPurchase(a_item);
}
// POST api/<SyncSalesController>
/// <summary>
/// Endpoint to publish a collection of Customer Account rows to the cloud
/// </summary>
/// <param name="a_item"></param>
[Authorize]
[HttpPost, Route("publish/tblCustomerAccount")]
public async Task SyncCustomerAccountAsync(List<Customeraccount> a_item)
{
await m_salesService.SyncCustomerAccount(a_item);
}
// POST api/<SyncSalesController>
/// <summary>
/// Endpoint to publish a collection of Customer Purchase rows to the cloud
/// </summary>
/// <param name="a_item"></param>
[Authorize]
[HttpPost, Route("publish/CustomerPurchase")]
public async Task SyncCustomerPurchaseAsync(List<Tblcustomerpurchase> a_item)
{
await m_salesService.SyncCustomerPurchase(a_item);
}
// POST api/<SyncSalesController>
/// <summary>
/// Endpoint to publish a collection of Discount logs rows to the cloud
/// </summary>
/// <param name="a_item"></param>
[Authorize]
[HttpPost, Route("publish/DiscountLogs")]
public async Task SyncDiscountLogsAsync(List<Tbldiscountlog> a_item)
{
await m_salesService.SyncDiscountLogs(a_item);
}
// POST api/<SyncSalesController>
/// <summary>
/// Endpoint to publish a collection of Delivery Head rows to the cloud
/// </summary>
/// <param name="a_item"></param>
[Authorize]
[HttpPost, Route("publish/tblDeliveryhead")]
public async Task SyncDeliveryHeadAsync(List<Tbldeliveryhead> a_item)
{
await m_salesService.SyncDeliveryHead(a_item);
}
// POST api/<SyncSalesController>
/// <summary>
/// Endpoint to publish a collection of Delivery Details rows to the cloud
/// </summary>
/// <param name="a_item"></param>
[Authorize]
[HttpPost, Route("publish/tblDeliverydetails")]
public async Task SyncDeliveryDetailsAsync(List<Tbldeliverydetail> a_item)
{
await m_salesService.SyncDeliveryDetails(a_item);
}
// POST api/<SyncSalesController>
/// <summary>
/// Endpoint to publish a collection of Delivery Recipient rows to the cloud
/// </summary>
/// <param name="a_item"></param>
[Authorize]
[HttpPost, Route("publish/tblDeliveryrecipient")]
public async Task SyncDeliveryRecipientAsync(List<Tbldeliveryrecipient> a_item)
{
await m_salesService.SyncDeliveryRecipients(a_item);
}
}
}