示例#1
0
        public void OutputCustomerInfoById(int customerId)
        {
            var message  = default(string);
            var customer = _memoryCache.GetOrCreate(customerId, () => GetObjectById(customerId), out message);

            Speaker.Output(message + "Person Id - " + customer.Id.ToString() + " Name - " + customer.Name);
        }
示例#2
0
        public async Task OutputInfoAboutFoodAsync(int foodId)
        {
            var message = default(string);
            var foods   = _memoryCache.GetOrCreate(foodId, () => GetObjectById(foodId), out message);

            if (foods is not null)
            {
                Speaker.Output(
                    "Food Id - " + foods.Id.ToString() + " " + foods.Name + ", Count - "
                    + foods.Count.ToString() + " UAN - " + foods.Price + " USD - "
                    + Decimal.Round(foods.Price / await _currencyExchanger.GetExchangeRateAsync("USD"), 2)
                    );
            }
        }