Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private Document BeforeEdit(Document newDocument)
- {
- Document bdDocument = repDocuments.Get(d => d.Id == newDocument.Id);
- PropertyInfo[] destinationProperties = bdDocument.GetType().GetProperties();
- foreach (PropertyInfo destinationPI in destinationProperties)
- {
- PropertyInfo sourcePI = newDocument.GetType().GetProperty(destinationPI.Name);
- Object newValue = sourcePI.GetValue(newDocument, null);
- if (destinationPI.Name != "CreationDate" && newValue != null && newValue.ToString()!="0")
- {
- destinationPI.SetValue(bdDocument, newValue, null);
- }
- }
- return bdDocument;
- }
Add Comment
Please, Sign In to add comment