using Avalonia.Controls; using AvaloniaTeachersDB.Models; using AvaloniaTeachersDB.Views; using Microsoft.EntityFrameworkCore; using ReactiveUI; using System.Collections.Generic; using System.Data; using System.Linq; namespace AvaloniaTeachersDB.ViewModels { public class MainWindowViewModel : ViewModelBase { UserControl _us = new PersonalInformation(); PersonalInformationViewModel _personInf = new PersonalInformationViewModel(); AddTeacherViewModel _addTeacher = new AddTeacherViewModel(); public UserControl US { get => _us; set => this.RaiseAndSetIfChanged(ref _us, value); } public PersonalInformationViewModel PersonInf { get => _personInf; set => _personInf = value; } public AddTeacherViewModel AddTeacher { get => _addTeacher; set => _addTeacher = value; } public void ToAdd() { US = new AddTeacher(); } public void ToPersInf() { US = new PersonalInformation(); AddTeacher.CollSubSelect.Clear(); } public void ToAddNewTeacher() { if(AddTeacher.AddNewTeacher() == true) US = new PersonalInformation(); } } }