Advertisement
Guest User

Untitled

a guest
Oct 31st, 2014
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. public class User
  2. {
  3. public int Id {get;set;}
  4.  
  5. public string Name {get;set;}
  6.  
  7. public string Surname{get;set;}
  8. }
  9.  
  10. public class News
  11. {
  12. public int Id {get;set;}
  13.  
  14. public string Content {get;set;}
  15.  
  16. [ForeignKey("OwnerUser")]
  17. public int OwnerUserId{ get; set; }
  18.  
  19. public virtual User OwnerUser{ get; set; }
  20. }
  21.  
  22. public News InsertNews(News instance)
  23. {
  24. instance = RealInsertionCode(instance);
  25. User usr = GetObjectById(OwnerUserId);
  26. instance.OwnerUser = usr;
  27. return instance;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement