public static Economy defineFromBasketItemTrans(BasketItemTrans basketItemTrans) { if (DataEx.productInformations.ContainsKey(basketItemTrans.productId)) { ProductInformation productInformation = DataEx.productInformations[basketItemTrans.productId]; Economy economy = new Economy(); economy.currency = productInformation.currency; economy.total = productInformation.price * basketItemTrans.quantity; return(economy); } else { return(null); } }
public static Economy defineFromBasketItemTransList(List <BasketItemTrans> basketItemTransList) { Economy economy = new Economy(); foreach (BasketItemTrans basketItemTrans in basketItemTransList) { if (DataEx.productInformations.ContainsKey(basketItemTrans.productId)) { ProductInformation productInformation = DataEx.productInformations[basketItemTrans.productId]; economy.currency = productInformation.currency; // this is probably a bug in the future, just gonna keep it like this until it is economy.total += productInformation.price * basketItemTrans.quantity; } else { return(null); } } return(economy); }