/// <summary> /// Patch changes /// </summary> /// <param name="source"></param> /// <param name="target"></param> public static void Patch(this dataModel.Price source, dataModel.Price target) { if (target == null) { throw new ArgumentNullException("target"); } var patchInjection = new PatchInjection <dataModel.Price>(x => x.ProductId, x => x.List, x => x.MinQuantity, x => x.Sale); target.InjectFrom(patchInjection, source); }
public static dataModel.Price ToDataModel(this coreModel.Price price) { if (price == null) throw new ArgumentNullException("price"); var retVal = new dataModel.Price(); retVal.InjectFrom(price); retVal.ProductId = price.ProductId; retVal.MinQuantity = price.MinQuantity; return retVal; }
public static dataModel.Price ToDataModel(this coreModel.Price price) { if (price == null) { throw new ArgumentNullException("price"); } var retVal = new dataModel.Price(); retVal.InjectFrom(price); retVal.ProductId = price.ProductId; retVal.MinQuantity = price.MinQuantity; return(retVal); }
private void TryToCreateCatalogAssignment(dataModel.Price price, IPricingRepository repository) { //need create price list assignment to catalog if it not exist var product = _productService.GetById(price.ProductId, Domain.Catalog.Model.ItemResponseGroup.ItemInfo); if (!repository.PricelistAssignments.Where(x => x.PricelistId == price.PricelistId && x.CatalogId == product.CatalogId).Any()) { var assignment = new coreModel.PricelistAssignment { CatalogId = product.CatalogId, Name = product.Catalog.Name + "-" + price.Pricelist.Name, PricelistId = price.Pricelist.Id }; CreatePriceListAssignment(assignment); } }
/// <summary> /// Converting to model type /// </summary> /// <param name="dbEntity"></param> /// <returns></returns> public static coreModel.Price ToCoreModel(this dataModel.Price dbEntity) { if (dbEntity == null) { throw new ArgumentNullException("dbEntity"); } var retVal = new coreModel.Price(); retVal.InjectFrom(dbEntity); retVal.ProductId = dbEntity.ProductId; retVal.MinQuantity = (int)dbEntity.MinQuantity; if (dbEntity.Pricelist != null) { retVal.Currency = dbEntity.Pricelist.Currency; } return(retVal); }