|
@@ -1,12 +1,30 @@
|
|
|
-using System;
|
|
|
+using ReactiveUI;
|
|
|
+using System;
|
|
|
using System.Collections.Generic;
|
|
|
using System.Linq;
|
|
|
using System.Text;
|
|
|
using System.Threading.Tasks;
|
|
|
+using Teachers.Models;
|
|
|
|
|
|
namespace Teachers.ViewModels
|
|
|
{
|
|
|
- internal class AddCourseVM
|
|
|
+ internal class AddCourseVM : ViewModelBase
|
|
|
{
|
|
|
+ Course? _newCourse;
|
|
|
+
|
|
|
+ public Course? NewCourse { get => _newCourse; set => this.RaiseAndSetIfChanged(ref _newCourse, value); }
|
|
|
+
|
|
|
+ public AddCourseVM()
|
|
|
+ {
|
|
|
+ _newCourse = new Course();
|
|
|
+ }
|
|
|
+
|
|
|
+ public void AddCourse()
|
|
|
+ {
|
|
|
+ MainWindowViewModel.myConnection.Courses.Add(NewCourse);
|
|
|
+ MainWindowViewModel.myConnection.SaveChanges();
|
|
|
+ MainWindowViewModel.Instance.PageContent = new OneTeacherV();
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
}
|