Advertisement
Guest User

Untitled

a guest
Mar 5th, 2016
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. public ObservableCollection<ParentModel> ParentCollection { get; set; }
  2.  
  3. public List<Parent> ParentList { get; set; }
  4.  
  5. public ParentModel ParentModel { get; set; }
  6.  
  7. public MainViewModel()
  8. {
  9. Load();
  10. }
  11.  
  12. public void Load()
  13. {
  14. using (RegistrationEntities registrationContext = new RegistrationEntities())
  15. {
  16. ParentList = registrationContext.Parents.ToList();
  17.  
  18.  
  19. for (int i = 0; i < ParentList.Count; i++)
  20. {
  21. ParentModel = new ParentModel()
  22. {
  23. PId = ParentList[i].P_Id,
  24. PLastName = ParentList[i].P_LastName,
  25. PFirstName = ParentList[i].P_FirstName,
  26. PMiddleName = ParentList[i].P_MiddleName,
  27. PAddress = ParentList[i].P_Address,
  28. PContactNo = ParentList[i].P_ContactNo,
  29. PEmail = ParentList[i].P_Email,
  30. PUsername = ParentList[i].P_Username,
  31. PPassword = ParentList[i].P_Password,
  32. PCreatedOn = ParentList[i].P_CreatedOn,
  33. PUpdatedAt = ParentList[i].P_UpdatedAt
  34. };
  35.  
  36. ParentCollection.Add(ParentModel);
  37. }
  38. }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement