Example #1
0
 private static void FillProductNames(VmModel model, VmDto source)
 {
     foreach (ProductInfo product in model.Products)
     {
         ProductTypes productType = source.Products.Find(p => p.ProductId == product.ProductId).ProductType;
         product.ProductName = GetProductName(productType);
     }
 }
Example #2
0
        public static VmModel Map(VmDto source)
        {
            VmModel model = Mapper.Map<VmModel>(source);

            FillProductNames(model, source);
            FillCurrencyText(model, source);

            return model;
        }
Example #3
0
        private static VmDto GetInitData()
        {
            VmDto model = new VmDto
            {
                Currency = Currencies.Rub,
                EnteredSum = 0,
                UserWallet = new List<CoinDto>
                {
                    new CoinDto {CoinId = 1, Denomination = 1, Quantity = 10},
                    new CoinDto {CoinId = 2, Denomination = 2, Quantity = 30},
                    new CoinDto {CoinId = 3, Denomination = 5, Quantity = 20},
                    new CoinDto {CoinId = 4, Denomination = 10, Quantity = 15},
                },
                VMWallet = new List<CoinDto>
                {
                    new CoinDto {CoinId = 1, Denomination = 1, Quantity = 100},
                    new CoinDto {CoinId = 2, Denomination = 2, Quantity = 100},
                    new CoinDto {CoinId = 3, Denomination = 5, Quantity = 100},
                    new CoinDto {CoinId = 4, Denomination = 10, Quantity = 100},
                },
                Products = new List<ProductDto>
                {
                    new ProductDto {ProductId = 1, ProductType = ProductTypes.Tea, Price = 13, Quantity = 10},
                    new ProductDto {ProductId = 2, ProductType = ProductTypes.Coffee, Price = 18, Quantity = 20},
                    new ProductDto {ProductId = 3, ProductType = ProductTypes.CoffeeWithMilk, Price = 21, Quantity = 20},
                    new ProductDto {ProductId = 4, ProductType = ProductTypes.Juice, Price = 35, Quantity = 15},
                }
            };

            return model;
        }
Example #4
0
 public void SetData(VmDto initData)
 {
     DataStorage = initData;
 }
Example #5
0
 private static void FillCurrencyText(VmModel model, VmDto source)
 {
     model.CurrencyText = GetCurrencyText(source.Currency);
 }