public void ModifyEngineMaterial(EngineMaterialDTO dto) { var updateEngineMaterial = _materialRepository.Get(dto.EngineMaterialId) as EngineMaterial; //获取需要更新的对象。 //更新。 if (updateEngineMaterial != null) { updateEngineMaterial.SetPart(dto.Pn); updateEngineMaterial.Name = dto.Name; updateEngineMaterial.Description = dto.Description; updateEngineMaterial.ManufacturerID = dto.ManufacturerId; _materialRepository.Modify(updateEngineMaterial); } }
public void DeleteEngineMaterial(EngineMaterialDTO dto) { var delEngineMaterial = _materialRepository.Get(dto.EngineMaterialId); //获取需要删除的对象。 _materialRepository.Remove(delEngineMaterial); //删除EngineMaterial。 }
public void InsertEngineMaterial(EngineMaterialDTO dto) { var engineMaterial = MaterialFactory.CreateEngineMaterial(dto.Name, dto.Description, dto.Pn); engineMaterial.ManufacturerID = dto.ManufacturerId; _materialRepository.Add(engineMaterial); }