using Cloud_Manager.Models.CustomModels; using Cloud_Manager.Models.Interfaces; using Cloud_Manager.Models.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 Cloud_Manager.Controllers.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/ [Authorize] [HttpGet, Route("lastsyncdate/{a_tableName}")] public DateTime GetLastSyncDate(string a_tableName) { return m_salesService.GetLastSyncDate(a_tableName); } // Post: api/ [Authorize] [HttpPost, Route("setsyncdate")] public void SetLastSyncDate(SyncTimestamp a_timestamp) { m_salesService.SetLastSyncDate(a_timestamp.TableName, a_timestamp.Timestamp); } // POST api/ /// /// Endpoint to publish a collection of TblCart rows to the cloud /// /// [Authorize] [HttpPost, Route("publish/tblCart")] public async Task SyncSalesAsync(List a_item) { await m_salesService.SyncCart(a_item); } // POST api/ /// /// Endpoint to publish a collection of TblCancelledTransation rows to the cloud /// /// [Authorize] [HttpPost, Route("publish/tblcancelledtransaction")] public async Task SyncCancelledTransactionAsync(List a_item) { await m_salesService.SyncCancelledTransaction(a_item); } // POST api/ /// /// Endpoint to publish a collection of TblInvoice rows to the cloud /// /// [Authorize] [HttpPost, Route("publish/tblinvoice")] public async Task SyncInvoiceAsync(List a_item) { await m_salesService.SyncInvoice(a_item); } // POST api/ /// /// Endpoint to publish a collection of CreditPurchase rows to the cloud /// /// [Authorize] [HttpPost, Route("publish/tblCreditpurchase")] public async Task SyncCreditPurchaseAsync(List a_item) { await m_salesService.SyncCreditPurchase(a_item); } // POST api/ /// /// Endpoint to publish a collection of Customer Account rows to the cloud /// /// [Authorize] [HttpPost, Route("publish/tblCustomerAccount")] public async Task SyncCustomerAccountAsync(List a_item) { await m_salesService.SyncCustomerAccount(a_item); } // POST api/ /// /// Endpoint to publish a collection of Customer Purchase rows to the cloud /// /// [Authorize] [HttpPost, Route("publish/CustomerPurchase")] public async Task SyncCustomerPurchaseAsync(List a_item) { await m_salesService.SyncCustomerPurchase(a_item); } // POST api/ /// /// Endpoint to publish a collection of Discount logs rows to the cloud /// /// [Authorize] [HttpPost, Route("publish/DiscountLogs")] public async Task SyncDiscountLogsAsync(List a_item) { await m_salesService.SyncDiscountLogs(a_item); } // POST api/ /// /// Endpoint to publish a collection of Delivery Head rows to the cloud /// /// [Authorize] [HttpPost, Route("publish/tblDeliveryhead")] public async Task SyncDeliveryHeadAsync(List a_item) { await m_salesService.SyncDeliveryHead(a_item); } // POST api/ /// /// Endpoint to publish a collection of Delivery Details rows to the cloud /// /// [Authorize] [HttpPost, Route("publish/tblDeliverydetails")] public async Task SyncDeliveryDetailsAsync(List a_item) { await m_salesService.SyncDeliveryDetails(a_item); } // POST api/ /// /// Endpoint to publish a collection of Delivery Recipient rows to the cloud /// /// [Authorize] [HttpPost, Route("publish/tblDeliveryrecipient")] public async Task SyncDeliveryRecipientAsync(List a_item) { await m_salesService.SyncDeliveryRecipients(a_item); } } }