示例#1
0
        public ModelLibrary.Price ConvertPriceToModel(DatabaseAccessLibrary.Price price)
        {
            if (price == null)
            {
                return(null);
            }

            var modelPrice = new ModelLibrary.Price
            {
                VarPrice  = price.price1,
                StartDate = price.startDate,
                EndDate   = price.endDate,
            };

            return(modelPrice);
        }
示例#2
0
        public DatabaseAccessLibrary.Price ConvertPriceToDb(ModelLibrary.Price price, int itemId)
        {
            var priceDb = new PriceDb();
            var prices  = priceDb.GetPriceItemIdList(itemId);

            var pric = prices.First();

            if (pric == null)
            {
                return(null);
            }
            var dbPrice = new DatabaseAccessLibrary.Price
            {
                price1    = price.VarPrice,
                startDate = price.StartDate,
                endDate   = price.EndDate,
                itemId    = pric.itemId
            };

            return(dbPrice);
        }
示例#3
0
        public ModelLibrary.Price CreatePrice(ModelLibrary.Price price, int itemId)
        {
            var priceDb     = new PriceDb();
            var returnPrice = new ModelLibrary.Price
            {
                EndDate   = price.EndDate,
                StartDate = price.StartDate,
                VarPrice  = price.VarPrice
            };

            var dbPrice = new DatabaseAccessLibrary.Price
            {
                endDate   = price.EndDate,
                startDate = price.StartDate,
                price1    = price.VarPrice,
                itemId    = itemId
            };

            priceDb.AddPrice(dbPrice);

            return(returnPrice);
        }