public IHttpActionResult UpdatePalletProducts(PalletProductsSyncCollection palletProductCollection) { var terminal = TerminalServices.GetTerminalBySerial(palletProductCollection.SerialNo); if (terminal == null) { return(Unauthorized()); } var TransactionLog = TerminalServices.CheckTransactionLog(palletProductCollection.TransactionLogId, terminal.TerminalId); if (TransactionLog == true) { return(Conflict()); } foreach (var item in palletProductCollection.PalletProducts) { var result = _palletService.AddFulFillmentPalletProduct(AutoMapper.Mapper.Map <PalletProductsSync, PalletProductAddViewModel>(item)); if (result != null && result.PalletProductID > 0) { item.PalletProductID = result.PalletProductID; item.PostedSuccess = true; } } return(Ok(palletProductCollection)); }
public IHttpActionResult GetPalletProducts(DateTime reqDate, string serialNo) { var terminal = TerminalServices.GetTerminalBySerial(serialNo); if (terminal == null) { return(Unauthorized()); } reqDate = TerminalServices.GetTerminalSyncDate(reqDate, terminal.TenantId); var result = new PalletProductsSyncCollection { PalletProducts = _palletService.GetAllPalletProductsForSync(reqDate), SerialNo = serialNo }; result.Count = result.PalletProducts.Count; result.TerminalLogId = TerminalServices.CreateTerminalLog(reqDate, terminal.TenantId, result.Count, terminal.TerminalId, TerminalLogTypeEnum.PalletProductsSync).TerminalLogId; return(Ok(result)); }