コード例 #1
0
        public ProductViewModel(SearchUpcItemInfo itemInfo)
        {
            ProductName = itemInfo.ProductName;
            ImageUrl = itemInfo.ImageUrl;

            Price = ConvertToPrice(itemInfo);

            Currency = GetCurrencySymbol(itemInfo.Currency);

            Quantity = 1;

            DatePurchased = DateTime.UtcNow;
        }
コード例 #2
0
        public static decimal ConvertToPrice(SearchUpcItemInfo itemInfo)
        {
            decimal price;

            return decimal.TryParse(itemInfo.Price, out price) ? price : default(decimal);
        }