private static TemplateProductFlat Map(HSProduct product, HSPriceSchedule priceSchedule, Asset asset = null)
 {
     return(new TemplateProductFlat
     {
         ID = product.ID,
         Active = product.Active,
         ApplyShipping = priceSchedule.ApplyShipping,
         ApplyTax = priceSchedule.ApplyTax,
         Description = product.Description,
         IsResale = product.xp.IsResale,
         MaxQuantity = priceSchedule.MaxQuantity,
         MinQuantity = priceSchedule.MinQuantity,
         Name = product.Name,
         Price = priceSchedule.PriceBreaks.FirstOrDefault()?.Price,
         ShipFromAddressID = product.ShipFromAddressID,
         ShipHeight = product.ShipHeight,
         ShipLength = product.ShipLength,
         ShipWidth = product.ShipWidth,
         ShipWeight = product.ShipWeight,
         QuantityMultiplier = product.QuantityMultiplier,
         RestrictedQuantity = priceSchedule.RestrictedQuantity,
         TaxCategory = product.xp.Tax.Category,
         TaxCode = product.xp.Tax.Code,
         TaxDescription = product.xp.Tax.Description,
         UseCumulativeQuantity = priceSchedule.UseCumulativeQuantity,
         UnitOfMeasure = product.xp.UnitOfMeasure.Unit,
         UnitOfMeasureQuantity = product.xp.UnitOfMeasure.Qty,
         ImageTitle = asset?.Title,
         Url = asset?.Url,
         Type = asset?.Type ?? AssetType.Image,
         Tags = asset?.Tags?.JoinString(","),
         FileName = asset?.FileName,
         ProductType = product.xp.ProductType,
         SizeTier = product.xp.SizeTier
     });
 }
 public async Task <HSPriceSchedule> UpdatePricingOverride(string id, string buyerID, [FromBody] HSPriceSchedule priceSchedule)
 {
     return(await _command.UpdatePricingOverride(id, buyerID, priceSchedule, UserContext.AccessToken));
 }
        public async Task <HSPriceSchedule> UpdatePricingOverride(string id, string buyerID, HSPriceSchedule priceSchedule, string token)
        {
            var priceScheduleID  = $"{id}-{buyerID}";
            var newPriceSchedule = await _oc.PriceSchedules.SaveAsync <HSPriceSchedule>(priceScheduleID, priceSchedule);

            return(newPriceSchedule);
        }
        public async Task <HSPriceSchedule> CreatePricingOverride(string id, string buyerID, HSPriceSchedule priceSchedule, string token)
        {
            /* must add the price schedule to the visibility assignments */
            var priceScheduleID = $"{id}-{buyerID}";

            priceSchedule.ID = priceScheduleID;
            var newPriceSchedule = await _oc.PriceSchedules.SaveAsync <HSPriceSchedule>(priceScheduleID, priceSchedule);

            await AddPriceScheduleAssignmentToProductCatalogAssignments(id, buyerID, priceScheduleID);

            return(newPriceSchedule);
        }
 public async Task <HSPriceSchedule> PostPriceSchedule([FromBody] HSPriceSchedule obj)
 {
     return(await _command.SaveToQueue(obj, this.VerifiedUserContext, this.VerifiedUserContext.SupplierID));
 }