Guest User

Untitled

a guest
Apr 21st, 2018
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. private Document BeforeEdit(Document newDocument)
  2. {
  3. Document bdDocument = repDocuments.Get(d => d.Id == newDocument.Id);
  4.  
  5. PropertyInfo[] destinationProperties = bdDocument.GetType().GetProperties();
  6. foreach (PropertyInfo destinationPI in destinationProperties)
  7. {
  8. PropertyInfo sourcePI = newDocument.GetType().GetProperty(destinationPI.Name);
  9. Object newValue = sourcePI.GetValue(newDocument, null);
  10.  
  11. if (destinationPI.Name != "CreationDate" && newValue != null && newValue.ToString()!="0")
  12. {
  13. destinationPI.SetValue(bdDocument, newValue, null);
  14. }
  15. }
  16.  
  17. return bdDocument;
  18. }
Add Comment
Please, Sign In to add comment