MainWindowViewModel.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. using Avalonia.Controls;
  2. using AvaloniaTeachersDB.Models;
  3. using AvaloniaTeachersDB.Views;
  4. using Microsoft.EntityFrameworkCore;
  5. using ReactiveUI;
  6. using System.Collections.Generic;
  7. using System.Data;
  8. using System.Linq;
  9. namespace AvaloniaTeachersDB.ViewModels
  10. {
  11. public class MainWindowViewModel : ViewModelBase
  12. {
  13. UserControl _us = new PersonalInformation();
  14. PersonalInformationViewModel _personInf = new PersonalInformationViewModel();
  15. AddTeacherViewModel _addTeacher = new AddTeacherViewModel();
  16. public UserControl US
  17. {
  18. get => _us;
  19. set => this.RaiseAndSetIfChanged(ref _us, value);
  20. }
  21. public PersonalInformationViewModel PersonInf
  22. {
  23. get => _personInf;
  24. set => _personInf = value;
  25. }
  26. public AddTeacherViewModel AddTeacher
  27. {
  28. get => _addTeacher;
  29. set => _addTeacher = value;
  30. }
  31. public void ToAdd()
  32. {
  33. US = new AddTeacher();
  34. }
  35. public void ToPersInf()
  36. {
  37. US = new PersonalInformation();
  38. AddTeacher.CollSubSelect.Clear();
  39. }
  40. public void ToAddNewTeacher()
  41. {
  42. if(AddTeacher.AddNewTeacher() == true)
  43. US = new PersonalInformation();
  44. }
  45. }
  46. }