Skip to content

GetLabelImageForFood

Alex edited this page May 30, 2019 · 1 revision
var recipe = new RecipeDto();

recipe.Items = new[] 
{
    new FoodItemDto
    {
        FoodId = Guid.Parse("d6e1c25c-45ea-00e3-575f-443582096cec"), // Existing Food in Database
        Amount = new AmountDto
        {
            Quantity = new QuantityDto() { Type = QuantityType.Double, Value = "100" },
            UnitId = Guid.Parse("a7df0af5-0008-0000-7484-751e8eaf05c6") // gram
        }
    },
    new FoodItemDto
    {
        FoodId = Guid.Parse("d6e1c25c-45b2-00e3-575f-443582096cec"), // Existing Food in Database
        Amount = new AmountDto
        {
            Quantity = new QuantityDto() { Type = QuantityType.Double, Value = "75" },
            UnitId = Guid.Parse("a7df0af5-0008-0000-7484-751e8eaf05c6") // gram
        }
    },
};

var labelProfile = new LabelProfileDto
{
    Authority = new AuthorityDto
    {
        Id = new Guid("BBF4846D-8400-43BB-944D-6021FDA98225"), 
        Regulation = Regulations.UnitedStates2016
    },
    LabelFormat = LabelFormat.Full,
    LabelStyle = LabelStyle.Tabular,
    ServingSize = new[]
    {
        new GlobalString
        {
            Language = "en-US",
            Value = "1 Pizza Pie"
        }
    },
    ServingsPerContainer = new[]
    {
        new GlobalString
        {
            Language = "en-US",
            Value = "1"
        }
    }
};

var request = new ImageForFoodRequest { Food = pizza, LabelProfile = labelProfile };
var response = labelImageServiceClient.GetLabelImageForFood(request);

Clone this wiki locally