markjprice / apps-services-net8

Repository for the Packt Publishing book titled "Apps and Services with .NET 8" by Mark J. Price
119 stars 55 forks source link

CosmosDb Product Listing missing currency. #4

Open Pip1987 opened 9 months ago

Pip1987 commented 9 months ago

Page 297 Listing all products from the CosmosDB says to set the current culture to french to see the euro symbol. However the output for the unit price is converted to string and not displaying the currency symbol. Removing the ToString from unitPrice fixes this issue.

foreach (ProductCosmos product in products)
{
    WriteLine("id: {0}, productName: {1}, unitPrice: {2}",
    arg0: product.id, arg1: product.productName, 
    arg2: product.unitPrice.ToString());
}

to

foreach (ProductCosmos product in products)
{
    WriteLine("id: {0}, productName: {1}, unitPrice: {2}",
    arg0: product.id, arg1: product.productName, 
    arg2: product.unitPrice);
}
markjprice commented 9 months ago

I started to look into this but I don't have CosmosDB emulator set up and since I have publishing deadlines at the moment I will have to look at this another time. I will leave the issue open to remind me. Thanks for raising this though.