public static ProductPackaging Map(this tblProductPackaging productPackaging) { ProductPackaging p = new ProductPackaging(productPackaging.Id) { Name = productPackaging.Name, Description = productPackaging.description, Code=productPackaging.code }; if (productPackaging.Containment != null) { p.Containment = productPackaging.tblContainment.Map(); } if (productPackaging.ReturnableProduct != null) { p.ReturnableProductRef = new ProductRef { ProductId =productPackaging.ReturnableProduct.Value }; } p._SetStatus((EntityStatus)productPackaging.IM_Status); p._SetDateCreated(productPackaging.IM_DateCreated); p._SetDateLastUpdated(productPackaging.IM_DateLastUpdated); return p; }
protected Guid AddProductPackaging(string name, string desc, string code/*, int containmentId*/) { ProductPackaging pp = new ProductPackaging(Guid.NewGuid()) { Name = name, Description = desc, Code=code }; /*if(containmentId!=0){ pp.Containment = _containmentRepository.GetById(containmentId); }*/ pp._SetStatus(EntityStatus.Active); return _productPackagingRepository.Save(pp); }