public static ProductBrand Map(this tblProductBrand productBrand) { ProductBrand returnValue = new ProductBrand(productBrand.id) { Name = productBrand.name, Description = productBrand.description != null ? productBrand.description : "", Code = productBrand.code, //_Status = productBrand.active }; if (productBrand.SupplierId != null) returnValue.Supplier = productBrand.tblSupplier.Map(); returnValue._SetStatus((EntityStatus)productBrand.IM_Status); returnValue._SetDateCreated(productBrand.IM_DateCreated); returnValue._SetDateLastUpdated(productBrand.IM_DateLastUpdated); return returnValue; }
protected Guid AddProductBrand(Guid supplierId, string name, string desc, string code) { ProductBrand pb = new ProductBrand(Guid.NewGuid()) { Name = name, Description = desc, Code = code, Supplier=_supplierRepository.GetById(supplierId) }; pb._SetStatus(EntityStatus.Active); return _productBrandRepository.Save(pb); }