/// <summary> /// Initializes a new instance of the <see cref="ProductVM"/> class from the model. /// </summary> /// <param name="entity">The model.</param> /// <param name="access"></param> /// <param name="dataService"></param> /// <param name="presentationType"></param> public ProductDefectionVM(ProductDefection entity, AccessType access, ProductDefectionDataService dataService, RelationDirection presentationType):base(access, presentationType) { InitializeData(dataService); _model = entity; ProductId = entity.Product.Id; DefectionId = entity.Defection.Id; ProductName = entity.Product.Name; ProductCode = entity.Product.Code; DefectionName = entity.Defection.Name; DefectionCode = entity.Defection.Code; }
private void FixupProductDefection(ProductDefection previousValue) { if (previousValue != null && previousValue.DefectionReports.Contains(this)) { previousValue.DefectionReports.Remove(this); } if (ProductDefection != null) { if (!ProductDefection.DefectionReports.Contains(this)) { ProductDefection.DefectionReports.Add(this); } } }