public dynamic ToUnsafeExpandedWireFormat(AmazonUtilities amazon) { var result = ToSafeExpandedWireFormat(amazon); result.tags = Tags.Select(productTag => productTag.Tag).Select(tag => tag.ToSafeExpandedWireFormat()).ToList(); return(result); }
public ProductsController(BagsContext bagsContext, IConfiguration configuration) { _bagsContext = bagsContext; var associateTag = configuration["AmazonAssociateTag"]; if (associateTag == null) { throw new Exception("AmazonAssociateTag is missing."); } var accessKeyId = configuration["AmazonAccessKeyId"]; if (accessKeyId == null) { throw new Exception("AmazonAccessKeyId"); } var secretAccessKey = configuration["AmazonSecretAccessKey"]; if (secretAccessKey == null) { throw new Exception("AmazonSecretAccessKey"); } _amazon = new AmazonUtilities(accessKeyId, secretAccessKey, associateTag); }
public dynamic ToSafeExpandedWireFormat(AmazonUtilities amazon) { var result = ToBaseWireFormat(); result.images = JsonConvert.DeserializeObject <IEnumerable <Image> >(ImagesJson ?? "[]"); result.purchase_urls = new[] { amazon.CreateAssociateLink(AmazonProduct.Asin) }; return(result); }