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); }
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); }
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); }