public void Put(IRequest request, SalesInvoiceFeedEntry entry, string resource)
 {
     CRUD crud = new CRUD(request);
     crud.Update(entry, resource);
 }
        private SalesInvoiceFeedEntry GetPayload(Sage.Integration.Northwind.Adapter.Data.SalesOrders.DataSets.Order.CalculatedOrdersRow row,
            Sage.Integration.Northwind.Adapter.Data.SalesOrders.DataSets.Order.CalculatedOrderDetailsDataTable detailDataTable,
            //DataSets.Order.DeletedOrderDetailsDataTable deletedOrderDetailsDataTable,
            NorthwindConfig config)
        {
            #region Declarations
            SalesInvoiceFeedEntry payload;
            string id;
            CountryCodes countryCodes = new CountryCodes();
            #endregion

            id = row.OrderID.ToString();

            payload = new SalesInvoiceFeedEntry();
            payload.Key = id;
            payload.Id = GetSDataId(id);
            payload.UUID = GetUuid(id, "", SupportedResourceKinds.salesInvoices);
            payload.active = true;

            payload.currency = config.CurrencyCode;

            payload.pricelist = new PriceListFeedEntry();
            //TODO: Add Id?
            /*payload.pricelist = (PriceListPayload)PayloadFactory.CreateResourcePayload(
                SupportedResourceKinds.priceLists,
                Sage.Integration.Northwind.Application.API.Constants.DefaultValues.PriceList.ID, _context.DatasetLink, true);*/
            payload.pricelist.UUID = GetUuid(id, "", SupportedResourceKinds.priceLists);

            if (!row.IsCustomerIDNull())
            {
                /*payload.tradingAccount = (TradingAccountPayload)PayloadFactory.CreateResourcePayload(
                SupportedResourceKinds.tradingAccounts, Sage.Integration.Northwind.Application.API.Constants.CustomerIdPrefix +
                row.CustomerID, _context.DatasetLink, true);*/
                payload.tradingAccount = new TradingAccountFeedEntry();
                payload.tradingAccount.Key = Sage.Integration.Northwind.Application.API.Constants.CustomerIdPrefix + row.CustomerID;
                payload.tradingAccount.Id = (GetSDataId(payload.tradingAccount.Key, SupportedResourceKinds.tradingAccounts));
                payload.tradingAccount.UUID = GetUuid(payload.tradingAccount.Key, "", SupportedResourceKinds.tradingAccounts);
            }

            if (!row.IsOrderDateNull())
            {
                payload.date = row.OrderDate;
            }

            payload.discountTotal = row.IsDiscountAmountNull() ? new decimal(0) : Convert.ToDecimal(row.DiscountAmount);

            payload.netTotal = row.IsTotalNetPriceNull() ? new decimal(0) : Convert.ToDecimal(row.TotalNetPrice);

            payload.carrierTotalPrice = row.IsFreightNull() ? new decimal(0) : row.Freight;

            payload.grossTotal = payload.netTotal;

            if (!row.IsRequiredDateNull())
            {
                payload.deliveryDate = row.RequiredDate;
            }

            if (!row.IsShipViaNull())
            {
                payload.deliveryMethod = row.ShipVia.ToString(); ;
            }

            PostalAddressFeedEntry address = new PostalAddressFeedEntry();
            address.Id = GetSDataId(id, SupportedResourceKinds.postalAddresses);
            address.Key = id;
            address.active = true;
            address.address1 = row.IsShipAddressNull() ? "" : row.ShipAddress;
            address.country = row.IsShipCountryNull() ? "" : row.ShipCountry;
            address.townCity = row.IsShipCityNull() ? "" : row.ShipCity;
            address.zipPostCode = row.IsShipPostalCodeNull() ? "" : row.ShipPostalCode;
            address.type = postalAddressTypeenum.Shipping;

            payload.postalAddresses = new PostalAddressFeed();
            payload.postalAddresses.Entries.Add(address);

            payload.salesInvoiceLines = new SalesInvoiceLineFeed();
            foreach (Sage.Integration.Northwind.Adapter.Data.SalesOrders.DataSets.Order.CalculatedOrderDetailsRow detailRow in detailDataTable.Rows)
            {
                SalesInvoiceLineFeedEntry soPayload = GetLineItem(detailRow, config);
                soPayload.salesInvoice = payload;
                payload.salesInvoiceLines.Entries.Add(soPayload);
            }

            return payload;
        }
 public void Post(IRequest request, SalesInvoiceFeedEntry entry)
 {
     CRUD crud = new CRUD(request);
     crud.Create(entry);
 }