/// <summary>
		/// Converting to model type
		/// </summary>
		/// <param name="catalogBase"></param>
		/// <returns></returns>
		public static coreModel.Pricelist ToCoreModel(this dataModel.Pricelist dbEntity)
		{
			if (dbEntity == null)
				throw new ArgumentNullException("dbEntity");

			var retVal = new coreModel.Pricelist();
			retVal.InjectFrom(dbEntity);
			retVal.Currency = dbEntity.Currency;
			retVal.Prices = dbEntity.Prices.Select(x => x.ToCoreModel()).ToList();
		
			return retVal;

		}
		public static coreModel.Pricelist ToCoreModel(this webModel.Pricelist priceList)
		{
			var retVal = new coreModel.Pricelist();
			retVal.InjectFrom(priceList);
			retVal.Currency = priceList.Currency;
			if (priceList.ProductPrices != null)
			{
				retVal.Prices = priceList.ProductPrices.SelectMany(x=>x.Prices).Select(x => x.ToCoreModel()).ToList();
			}
			if (priceList.Assignments != null)
			{
				retVal.Assignments = priceList.Assignments.Select(x => x.ToCoreModel()).ToList();
			}
			return retVal;
		}
        /// <summary>
        /// Converting to model type
        /// </summary>
        /// <param name="catalogBase"></param>
        /// <returns></returns>
        public static coreModel.Pricelist ToCoreModel(this dataModel.Pricelist dbEntity)
        {
            if (dbEntity == null)
            {
                throw new ArgumentNullException("dbEntity");
            }

            var retVal = new coreModel.Pricelist();

            retVal.InjectFrom(dbEntity);
            retVal.Currency = (CurrencyCodes)Enum.Parse(typeof(CurrencyCodes), dbEntity.Currency);
            retVal.Prices   = dbEntity.Prices.Select(x => x.ToCoreModel()).ToList();

            return(retVal);
        }
Esempio n. 4
0
        public static coreModel.Pricelist ToCoreModel(this webModel.Pricelist priceList)
        {
            var retVal = new coreModel.Pricelist();

            retVal.InjectFrom(priceList);
            retVal.Currency = priceList.Currency;
            if (priceList.ProductPrices != null)
            {
                retVal.Prices = priceList.ProductPrices.SelectMany(x => x.Prices).Select(x => x.ToCoreModel()).ToList();
            }
            if (priceList.Assignments != null)
            {
                retVal.Assignments = priceList.Assignments.Select(x => x.ToCoreModel()).ToList();
            }
            return(retVal);
        }