diff --git a/SchoolSchedule/SchoolSchedule.sln b/SchoolSchedule/SchoolSchedule.sln
index fb77595..055d3ef 100644
--- a/SchoolSchedule/SchoolSchedule.sln
+++ b/SchoolSchedule/SchoolSchedule.sln
@@ -3,7 +3,18 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.9.34701.34
MinimumVisualStudioVersion = 10.0.40219.1
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SchoolSchedule", "SchoolSchedule\SchoolSchedule.csproj", "{DEDD5B0C-5F76-4EB4-809C-E2343CF92FCE}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SchoolSchedule", "SchoolSchedule\SchoolSchedule.csproj", "{DEDD5B0C-5F76-4EB4-809C-E2343CF92FCE}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SchoolScheduleDataModels", "SchoolScheduleDataModels\SchoolScheduleDataModels.csproj", "{7FB0B40C-7E5B-4675-A52E-3A9CB8ECBD26}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SchoolScheduleContracts", "SchoolScheduleContracts\SchoolScheduleContracts.csproj", "{AAC735A1-0806-4556-8371-7F001E0ADFAD}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SchoolScheduleBusinessLogic", "SchoolScheduleBusinessLogic\SchoolScheduleBusinessLogic.csproj", "{1F155433-B778-4252-8637-5B3561C5AD1E}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SchoolScheduleDataBaseImplement", "SchoolScheduleDataBaseImplement\SchoolScheduleDataBaseImplement.csproj", "{3B115972-7390-4FD9-87E0-FAFE78C4A178}"
+ ProjectSection(ProjectDependencies) = postProject
+ {AAC735A1-0806-4556-8371-7F001E0ADFAD} = {AAC735A1-0806-4556-8371-7F001E0ADFAD}
+ EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -15,6 +26,22 @@ Global
{DEDD5B0C-5F76-4EB4-809C-E2343CF92FCE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DEDD5B0C-5F76-4EB4-809C-E2343CF92FCE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DEDD5B0C-5F76-4EB4-809C-E2343CF92FCE}.Release|Any CPU.Build.0 = Release|Any CPU
+ {7FB0B40C-7E5B-4675-A52E-3A9CB8ECBD26}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {7FB0B40C-7E5B-4675-A52E-3A9CB8ECBD26}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {7FB0B40C-7E5B-4675-A52E-3A9CB8ECBD26}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {7FB0B40C-7E5B-4675-A52E-3A9CB8ECBD26}.Release|Any CPU.Build.0 = Release|Any CPU
+ {AAC735A1-0806-4556-8371-7F001E0ADFAD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {AAC735A1-0806-4556-8371-7F001E0ADFAD}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {AAC735A1-0806-4556-8371-7F001E0ADFAD}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {AAC735A1-0806-4556-8371-7F001E0ADFAD}.Release|Any CPU.Build.0 = Release|Any CPU
+ {1F155433-B778-4252-8637-5B3561C5AD1E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {1F155433-B778-4252-8637-5B3561C5AD1E}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {1F155433-B778-4252-8637-5B3561C5AD1E}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {1F155433-B778-4252-8637-5B3561C5AD1E}.Release|Any CPU.Build.0 = Release|Any CPU
+ {3B115972-7390-4FD9-87E0-FAFE78C4A178}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {3B115972-7390-4FD9-87E0-FAFE78C4A178}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {3B115972-7390-4FD9-87E0-FAFE78C4A178}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {3B115972-7390-4FD9-87E0-FAFE78C4A178}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/SchoolSchedule/SchoolSchedule/SchoolSchedule.csproj b/SchoolSchedule/SchoolSchedule/SchoolSchedule.csproj
index b57c89e..bce9b0e 100644
--- a/SchoolSchedule/SchoolSchedule/SchoolSchedule.csproj
+++ b/SchoolSchedule/SchoolSchedule/SchoolSchedule.csproj
@@ -2,10 +2,21 @@
WinExe
- net6.0-windows
+ net8.0-windows7.0
enable
true
enable
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/SchoolSchedule/SchoolScheduleBusinessLogic/GradeLogic.cs b/SchoolSchedule/SchoolScheduleBusinessLogic/GradeLogic.cs
new file mode 100644
index 0000000..a2a2c17
--- /dev/null
+++ b/SchoolSchedule/SchoolScheduleBusinessLogic/GradeLogic.cs
@@ -0,0 +1,112 @@
+using SchoolScheduleContracts.BindingModels;
+using SchoolScheduleContracts.BusinessLogicsContracts;
+using SchoolScheduleContracts.SearchModels;
+using SchoolScheduleContracts.StoragesContracts;
+using SchoolScheduleContracts.ViewModels;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SchoolScheduleBusinessLogic
+{
+ public class GradeLogic : IGradeLogic
+ {
+ private readonly IGradeStorage _gradeStorage;
+ private readonly IStudentStorage _studentStorage;
+ public GradeLogic(IGradeStorage gradeStorage, IStudentStorage studentStorage)
+ {
+ _gradeStorage = gradeStorage;
+ _studentStorage = studentStorage;
+ }
+
+ public List ReadList(GradeSearchModel? model)
+ {
+ var list = model == null ? _gradeStorage.GetFullList() :
+_gradeStorage.GetFilteredList(model);
+ return list;
+ }
+
+ public GradeViewModel? ReadElement(GradeSearchModel model)
+ {
+ if (model == null)
+ {
+ throw new ArgumentNullException(nameof(model));
+ }
+ var element = _gradeStorage.GetElement(model);
+ return element;
+ }
+
+ public List GetStudents(GradeSearchModel model)
+ {
+ var list = _studentStorage.GetFilteredList(new StudentSearchModel { GradeId = model.Id });
+ return list;
+ }
+
+ public bool Create(GradeBindingModel model)
+ {
+ CheckModel(model);
+ if (_gradeStorage.Insert(model) == null)
+ {
+ return false;
+ }
+ return true;
+ }
+ public bool Update(GradeBindingModel model)
+ {
+ CheckModel(model);
+ if (_gradeStorage.Update(model) == null)
+ {
+ return false;
+ }
+ return true;
+ }
+ public bool Delete(GradeBindingModel model)
+ {
+ CheckModel(model, false);
+ if (_gradeStorage.Delete(model) == null)
+ {
+ return false;
+ }
+ return true;
+ }
+
+ private void CheckModel(GradeBindingModel model, bool withParams =
+ true)
+ {
+ if (model == null)
+ {
+ throw new ArgumentNullException(nameof(model));
+ }
+ if (!withParams)
+ {
+ return;
+ }
+ if (!(model.Letter >= 'A' && model.Letter <= 'Z'))
+ {
+ throw new ArgumentNullException("Буква класса не является заглавной буквой",
+ nameof(model.Letter));
+ }
+ if (!(model.Year >= 1 && model.Year <= 11))
+ {
+ throw new ArgumentNullException("Год класса не является числом от 1 до 11",
+ nameof(model.Letter));
+
+ }
+
+ var element = _gradeStorage.GetElement(new GradeSearchModel
+ {
+ Letter = model.Letter,
+ Year = model.Year
+ });
+ if (element != null && element.Id != model.Id)
+ {
+ throw new InvalidOperationException("Такой класс уже есть");
+
+ }
+ }
+
+
+ }
+}
diff --git a/SchoolSchedule/SchoolScheduleBusinessLogic/LessonLogic.cs b/SchoolSchedule/SchoolScheduleBusinessLogic/LessonLogic.cs
new file mode 100644
index 0000000..2cde84d
--- /dev/null
+++ b/SchoolSchedule/SchoolScheduleBusinessLogic/LessonLogic.cs
@@ -0,0 +1,120 @@
+using SchoolScheduleContracts.BindingModels;
+using SchoolScheduleContracts.BusinessLogicsContracts;
+using SchoolScheduleContracts.SearchModels;
+using SchoolScheduleContracts.StoragesContracts;
+using SchoolScheduleContracts.ViewModels;
+using SchoolScheduleDataModels.Enums;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SchoolScheduleBusinessLogic
+{
+ public class LessonLogic : ILessonLogic
+ {
+ private readonly ILessonStorage _lessonStorage;
+ private readonly ISubjectStorage _subjectStorage;
+ private readonly ITeacherStorage _teacherStorage;
+ private readonly IGradeStorage _gradeStorage;
+ private readonly IStudentStorage _studentStorage;
+ public LessonLogic(ILessonStorage lessonStorage, ISubjectStorage subjectStorage, ITeacherStorage teacherStorage, IGradeStorage gradeStorage, IStudentStorage studentStorage)
+ {
+ _lessonStorage = lessonStorage;
+ _subjectStorage = subjectStorage;
+ _teacherStorage = teacherStorage;
+ _gradeStorage = gradeStorage;
+ _studentStorage = studentStorage;
+ }
+
+ public List ReadList(LessonSearchModel? model)
+ {
+ var list = model == null ? _lessonStorage.GetFullList() :
+_lessonStorage.GetFilteredList(model);
+ return list;
+ }
+
+ public LessonViewModel? ReadElement(LessonSearchModel model)
+ {
+ if (model == null)
+ {
+ throw new ArgumentNullException(nameof(model));
+ }
+ var element = _lessonStorage.GetElement(model);
+ return element;
+ }
+
+ public List GetStudents(LessonSearchModel model)
+ {
+ var list = _studentStorage.GetFilteredList(new StudentSearchModel { GradeId = model.GradeId });
+ return list;
+ }
+
+ public bool Create(LessonBindingModel model)
+ {
+ CheckModel(model);
+ if (_lessonStorage.Insert(model) == null)
+ {
+ return false;
+ }
+ return true;
+ }
+ public bool Update(LessonBindingModel model)
+ {
+ CheckModel(model);
+ if (_lessonStorage.Update(model) == null)
+ {
+ return false;
+ }
+ return true;
+ }
+ public bool Delete(LessonBindingModel model)
+ {
+ CheckModel(model, false);
+ if (_lessonStorage.Delete(model) == null)
+ {
+ return false;
+ }
+ return true;
+ }
+
+ private void CheckModel(LessonBindingModel model, bool withParams =
+ true)
+ {
+ if (model == null)
+ {
+ throw new ArgumentNullException(nameof(model));
+ }
+ if (!withParams)
+ {
+ return;
+ }
+
+ var element1 = _lessonStorage.GetElement(new LessonSearchModel
+ {
+ Date = model.Date,
+ SchedulePlaceId = model.SchedulePlaceId,
+ TeacherId = model.TeacherId
+ });
+ var element2 = _lessonStorage.GetElement(new LessonSearchModel
+ {
+ Date = model.Date,
+ SchedulePlaceId = model.SchedulePlaceId,
+ GradeId = model.GradeId
+ });
+
+ if (element1 != null)
+ {
+ throw new InvalidOperationException("У учителя уже есть урок в это время");
+
+ }
+
+ if (element2 != null)
+ {
+ throw new InvalidOperationException("У класса уже есть урок в это время");
+
+ }
+ }
+ }
+}
diff --git a/SchoolSchedule/SchoolScheduleBusinessLogic/SchedulePlaceLogic.cs b/SchoolSchedule/SchoolScheduleBusinessLogic/SchedulePlaceLogic.cs
new file mode 100644
index 0000000..dafdc01
--- /dev/null
+++ b/SchoolSchedule/SchoolScheduleBusinessLogic/SchedulePlaceLogic.cs
@@ -0,0 +1,64 @@
+using SchoolScheduleContracts.BindingModels;
+using SchoolScheduleContracts.BusinessLogicsContracts;
+using SchoolScheduleContracts.SearchModels;
+using SchoolScheduleContracts.StoragesContracts;
+using SchoolScheduleContracts.ViewModels;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SchoolScheduleBusinessLogic
+{
+ public class SchedulePlaceLogic : ISchedulePlaceLogic
+ {
+ private readonly ISchedulePlaceStorage _schedulePlaceStorage;
+ public SchedulePlaceLogic(ISchedulePlaceStorage schedulePlaceStorage)
+ {
+ _schedulePlaceStorage = schedulePlaceStorage;
+ }
+
+ public List ReadList(SchedulePlaceSearchModel? model)
+ {
+ var list = model == null ? _schedulePlaceStorage.GetFullList() :
+_schedulePlaceStorage.GetFilteredList(model);
+ return list;
+ }
+
+ public SchedulePlaceViewModel? ReadElement(SchedulePlaceSearchModel model)
+ {
+ if (model == null)
+ {
+ throw new ArgumentNullException(nameof(model));
+ }
+ var element = _schedulePlaceStorage.GetElement(model);
+ return element;
+ }
+ public bool Create(SchedulePlaceBindingModel model)
+ {
+ if (_schedulePlaceStorage.Insert(model) == null)
+ {
+ return false;
+ }
+ return true;
+ }
+ public bool Update(SchedulePlaceBindingModel model)
+ {
+ if (_schedulePlaceStorage.Update(model) == null)
+ {
+ return false;
+ }
+ return true;
+ }
+ public bool Delete(SchedulePlaceBindingModel model)
+ {
+ if (_schedulePlaceStorage.Delete(model) == null)
+ {
+ return false;
+ }
+ return true;
+ }
+
+ }
+}
diff --git a/SchoolSchedule/SchoolScheduleBusinessLogic/SchoolScheduleBusinessLogic.csproj b/SchoolSchedule/SchoolScheduleBusinessLogic/SchoolScheduleBusinessLogic.csproj
new file mode 100644
index 0000000..8ac14bf
--- /dev/null
+++ b/SchoolSchedule/SchoolScheduleBusinessLogic/SchoolScheduleBusinessLogic.csproj
@@ -0,0 +1,13 @@
+
+
+
+ net8.0
+ enable
+ enable
+
+
+
+
+
+
+
diff --git a/SchoolSchedule/SchoolScheduleBusinessLogic/StudentLogic.cs b/SchoolSchedule/SchoolScheduleBusinessLogic/StudentLogic.cs
new file mode 100644
index 0000000..02cef63
--- /dev/null
+++ b/SchoolSchedule/SchoolScheduleBusinessLogic/StudentLogic.cs
@@ -0,0 +1,63 @@
+using SchoolScheduleContracts.BindingModels;
+using SchoolScheduleContracts.BusinessLogicsContracts;
+using SchoolScheduleContracts.SearchModels;
+using SchoolScheduleContracts.StoragesContracts;
+using SchoolScheduleContracts.ViewModels;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SchoolScheduleBusinessLogic
+{
+ public class StudentLogic : IStudentLogic
+ {
+ private readonly IStudentStorage _studentStorage;
+ public StudentLogic(IStudentStorage studentStorage)
+ {
+ _studentStorage = studentStorage;
+ }
+
+ public List ReadList(StudentSearchModel? model)
+ {
+ var list = model == null ? _studentStorage.GetFullList() :
+_studentStorage.GetFilteredList(model);
+ return list;
+ }
+
+ public StudentViewModel? ReadElement(StudentSearchModel model)
+ {
+ if (model == null)
+ {
+ throw new ArgumentNullException(nameof(model));
+ }
+ var element = _studentStorage.GetElement(model);
+ return element;
+ }
+ public bool Create(StudentBindingModel model)
+ {
+ if (_studentStorage.Insert(model) == null)
+ {
+ return false;
+ }
+ return true;
+ }
+ public bool Update(StudentBindingModel model)
+ {
+ if (_studentStorage.Update(model) == null)
+ {
+ return false;
+ }
+ return true;
+ }
+ public bool Delete(StudentBindingModel model)
+ {
+ if (_studentStorage.Delete(model) == null)
+ {
+ return false;
+ }
+ return true;
+ }
+ }
+}
diff --git a/SchoolSchedule/SchoolScheduleBusinessLogic/SubjectLogic.cs b/SchoolSchedule/SchoolScheduleBusinessLogic/SubjectLogic.cs
new file mode 100644
index 0000000..3f41daf
--- /dev/null
+++ b/SchoolSchedule/SchoolScheduleBusinessLogic/SubjectLogic.cs
@@ -0,0 +1,96 @@
+using SchoolScheduleContracts.BindingModels;
+using SchoolScheduleContracts.BusinessLogicsContracts;
+using SchoolScheduleContracts.SearchModels;
+using SchoolScheduleContracts.StoragesContracts;
+using SchoolScheduleContracts.ViewModels;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SchoolScheduleBusinessLogic
+{
+ public class SubjectLogic : ISubjectLogic
+ {
+ private readonly ISubjectStorage _subjectStorage;
+ public SubjectLogic(ISubjectStorage subjectStorage)
+ {
+ _subjectStorage = subjectStorage;
+ }
+
+ public List ReadList(SubjectSearchModel? model)
+ {
+ var list = model == null ? _subjectStorage.GetFullList() :
+_subjectStorage.GetFilteredList(model);
+ return list;
+ }
+
+ public SubjectViewModel? ReadElement(SubjectSearchModel model)
+ {
+ if (model == null)
+ {
+ throw new ArgumentNullException(nameof(model));
+ }
+ var element = _subjectStorage.GetElement(model);
+ return element;
+ }
+ public bool Create(SubjectBindingModel model)
+ {
+ CheckModel(model);
+ if (_subjectStorage.Insert(model) == null)
+ {
+ return false;
+ }
+ return true;
+ }
+ public bool Update(SubjectBindingModel model)
+ {
+ CheckModel(model);
+ if (_subjectStorage.Update(model) == null)
+ {
+ return false;
+ }
+ return true;
+ }
+ public bool Delete(SubjectBindingModel model)
+ {
+ CheckModel(model, false);
+ if (_subjectStorage.Delete(model) == null)
+ {
+ return false;
+ }
+ return true;
+ }
+
+
+ private void CheckModel(SubjectBindingModel model, bool withParams =
+ true)
+ {
+ if (model == null)
+ {
+ throw new ArgumentNullException(nameof(model));
+ }
+ if (!withParams)
+ {
+ return;
+ }
+ if (string.IsNullOrEmpty(model.SubjectName))
+ {
+ throw new ArgumentNullException("Нет названия предмета",
+ nameof(model.SubjectName));
+ }
+ var element = _subjectStorage.GetElement(new SubjectSearchModel
+ {
+ SubjectName = model.SubjectName
+ });
+ if (element != null && element.Id != model.Id)
+ {
+ throw new InvalidOperationException("Предмет с таким названием уже есть");
+
+ }
+
+ }
+
+ }
+}
diff --git a/SchoolSchedule/SchoolScheduleBusinessLogic/TeacherLogic.cs b/SchoolSchedule/SchoolScheduleBusinessLogic/TeacherLogic.cs
new file mode 100644
index 0000000..7be3b50
--- /dev/null
+++ b/SchoolSchedule/SchoolScheduleBusinessLogic/TeacherLogic.cs
@@ -0,0 +1,63 @@
+using SchoolScheduleContracts.BindingModels;
+using SchoolScheduleContracts.BusinessLogicsContracts;
+using SchoolScheduleContracts.SearchModels;
+using SchoolScheduleContracts.StoragesContracts;
+using SchoolScheduleContracts.ViewModels;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SchoolScheduleBusinessLogic
+{
+ public class TeacherLogic : ITeacherLogic
+ {
+ private readonly ITeacherStorage _teacherStorage;
+ public TeacherLogic(ITeacherStorage teacherStorage)
+ {
+ _teacherStorage = teacherStorage;
+ }
+
+ public List ReadList(TeacherSearchModel? model)
+ {
+ var list = model == null ? _teacherStorage.GetFullList() :
+_teacherStorage.GetFilteredList(model);
+ return list;
+ }
+
+ public TeacherViewModel? ReadElement(TeacherSearchModel model)
+ {
+ if (model == null)
+ {
+ throw new ArgumentNullException(nameof(model));
+ }
+ var element = _teacherStorage.GetElement(model);
+ return element;
+ }
+ public bool Create(TeacherBindingModel model)
+ {
+ if (_teacherStorage.Insert(model) == null)
+ {
+ return false;
+ }
+ return true;
+ }
+ public bool Update(TeacherBindingModel model)
+ {
+ if (_teacherStorage.Update(model) == null)
+ {
+ return false;
+ }
+ return true;
+ }
+ public bool Delete(TeacherBindingModel model)
+ {
+ if (_teacherStorage.Delete(model) == null)
+ {
+ return false;
+ }
+ return true;
+ }
+ }
+}
diff --git a/SchoolSchedule/SchoolScheduleContracts/BindingModels/GradeBindingModel.cs b/SchoolSchedule/SchoolScheduleContracts/BindingModels/GradeBindingModel.cs
new file mode 100644
index 0000000..014b525
--- /dev/null
+++ b/SchoolSchedule/SchoolScheduleContracts/BindingModels/GradeBindingModel.cs
@@ -0,0 +1,17 @@
+using SchoolScheduleDataModels.Models;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SchoolScheduleContracts.BindingModels
+{
+ public class GradeBindingModel : IGradeModel
+ {
+ public int Id { get; set; }
+ public char Letter { get; set; }
+ public int Year { get; set; }
+ public int TeacherId { get; set; }
+ }
+}
diff --git a/SchoolSchedule/SchoolScheduleContracts/BindingModels/LessonBindingModel.cs b/SchoolSchedule/SchoolScheduleContracts/BindingModels/LessonBindingModel.cs
new file mode 100644
index 0000000..6bf1ee7
--- /dev/null
+++ b/SchoolSchedule/SchoolScheduleContracts/BindingModels/LessonBindingModel.cs
@@ -0,0 +1,20 @@
+using SchoolScheduleDataModels.Models;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SchoolScheduleContracts.BindingModels
+{
+ public class LessonBindingModel : ILessonModel
+ {
+ public int Id { get; set; }
+ public DateOnly Date { get; set; }
+ public string? Homework { get; set; }
+ public int SchedulePlaceId { get; set; }
+ public int TeacherId { get; set; }
+ public int SubjectId { get; set; }
+ public int GradeId { get; set; }
+ }
+}
diff --git a/SchoolSchedule/SchoolScheduleContracts/BindingModels/SchedulePlaceBindingModel.cs b/SchoolSchedule/SchoolScheduleContracts/BindingModels/SchedulePlaceBindingModel.cs
new file mode 100644
index 0000000..202c3e6
--- /dev/null
+++ b/SchoolSchedule/SchoolScheduleContracts/BindingModels/SchedulePlaceBindingModel.cs
@@ -0,0 +1,15 @@
+using SchoolScheduleDataModels.Models;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SchoolScheduleContracts.BindingModels
+{
+ public class SchedulePlaceBindingModel : ISchedulePlaceModel
+ {
+ public int Id { get; set; }
+ public TimeOnly Time { get; set; }
+ }
+}
diff --git a/SchoolSchedule/SchoolScheduleContracts/BindingModels/StudentBindingModel.cs b/SchoolSchedule/SchoolScheduleContracts/BindingModels/StudentBindingModel.cs
new file mode 100644
index 0000000..ead5804
--- /dev/null
+++ b/SchoolSchedule/SchoolScheduleContracts/BindingModels/StudentBindingModel.cs
@@ -0,0 +1,18 @@
+using SchoolScheduleDataModels.Enums;
+using SchoolScheduleDataModels.Models;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SchoolScheduleContracts.BindingModels
+{
+ public class StudentBindingModel : IStudentModel
+ {
+ public int Id { get; set; }
+ public string FullName { get; set; } = string.Empty;
+ public int GradeId { get; set; }
+ public Dictionary Attendance { get; set; } = new();
+ }
+}
diff --git a/SchoolSchedule/SchoolScheduleContracts/BindingModels/SubjectBindingModel.cs b/SchoolSchedule/SchoolScheduleContracts/BindingModels/SubjectBindingModel.cs
new file mode 100644
index 0000000..e0707f1
--- /dev/null
+++ b/SchoolSchedule/SchoolScheduleContracts/BindingModels/SubjectBindingModel.cs
@@ -0,0 +1,15 @@
+using SchoolScheduleDataModels.Models;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SchoolScheduleContracts.BindingModels
+{
+ public class SubjectBindingModel : ISubjectModel
+ {
+ public int Id { get; set; }
+ public string SubjectName { get; set; } = string.Empty;
+ }
+}
diff --git a/SchoolSchedule/SchoolScheduleContracts/BindingModels/TeacherBindingModel.cs b/SchoolSchedule/SchoolScheduleContracts/BindingModels/TeacherBindingModel.cs
new file mode 100644
index 0000000..4d0d715
--- /dev/null
+++ b/SchoolSchedule/SchoolScheduleContracts/BindingModels/TeacherBindingModel.cs
@@ -0,0 +1,16 @@
+using SchoolScheduleDataModels.Enums;
+using SchoolScheduleDataModels.Models;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SchoolScheduleContracts.BindingModels
+{
+ public class TeacherBindingModel : ITeacherModel
+ {
+ public int Id { get; set; }
+ public string FullName { get; set; } = string.Empty;
+ }
+}
diff --git a/SchoolSchedule/SchoolScheduleContracts/BusinessLogicsContracts/IGradeLogic.cs b/SchoolSchedule/SchoolScheduleContracts/BusinessLogicsContracts/IGradeLogic.cs
new file mode 100644
index 0000000..56ecb23
--- /dev/null
+++ b/SchoolSchedule/SchoolScheduleContracts/BusinessLogicsContracts/IGradeLogic.cs
@@ -0,0 +1,21 @@
+using SchoolScheduleContracts.BindingModels;
+using SchoolScheduleContracts.SearchModels;
+using SchoolScheduleContracts.ViewModels;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SchoolScheduleContracts.BusinessLogicsContracts
+{
+ public interface IGradeLogic
+ {
+ List ReadList(GradeSearchModel? model);
+ GradeViewModel? ReadElement(GradeSearchModel? model);
+ List GetStudents(GradeSearchModel model);
+ bool Create(GradeBindingModel model);
+ bool Update(GradeBindingModel model);
+ bool Delete(GradeBindingModel model);
+ }
+}
diff --git a/SchoolSchedule/SchoolScheduleContracts/BusinessLogicsContracts/ILessonLogic.cs b/SchoolSchedule/SchoolScheduleContracts/BusinessLogicsContracts/ILessonLogic.cs
new file mode 100644
index 0000000..02dc738
--- /dev/null
+++ b/SchoolSchedule/SchoolScheduleContracts/BusinessLogicsContracts/ILessonLogic.cs
@@ -0,0 +1,20 @@
+using SchoolScheduleContracts.BindingModels;
+using SchoolScheduleContracts.SearchModels;
+using SchoolScheduleContracts.ViewModels;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SchoolScheduleContracts.BusinessLogicsContracts
+{
+ public interface ILessonLogic
+ {
+ List? ReadList(LessonSearchModel? model);
+ LessonViewModel? ReadElement(LessonSearchModel model);
+ bool Create(LessonBindingModel model);
+ bool Update(LessonBindingModel model);
+ bool Delete(LessonBindingModel model);
+ }
+}
diff --git a/SchoolSchedule/SchoolScheduleContracts/BusinessLogicsContracts/ISchedulePlaceLogic.cs b/SchoolSchedule/SchoolScheduleContracts/BusinessLogicsContracts/ISchedulePlaceLogic.cs
new file mode 100644
index 0000000..5028114
--- /dev/null
+++ b/SchoolSchedule/SchoolScheduleContracts/BusinessLogicsContracts/ISchedulePlaceLogic.cs
@@ -0,0 +1,20 @@
+using SchoolScheduleContracts.BindingModels;
+using SchoolScheduleContracts.SearchModels;
+using SchoolScheduleContracts.ViewModels;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SchoolScheduleContracts.BusinessLogicsContracts
+{
+ public interface ISchedulePlaceLogic
+ {
+ List? ReadList(SchedulePlaceSearchModel? model);
+ SchedulePlaceViewModel? ReadElement(SchedulePlaceSearchModel model);
+ bool Create(SchedulePlaceBindingModel model);
+ bool Update(SchedulePlaceBindingModel model);
+ bool Delete(SchedulePlaceBindingModel model);
+ }
+}
diff --git a/SchoolSchedule/SchoolScheduleContracts/BusinessLogicsContracts/IStudentLogic.cs b/SchoolSchedule/SchoolScheduleContracts/BusinessLogicsContracts/IStudentLogic.cs
new file mode 100644
index 0000000..53022c0
--- /dev/null
+++ b/SchoolSchedule/SchoolScheduleContracts/BusinessLogicsContracts/IStudentLogic.cs
@@ -0,0 +1,20 @@
+using SchoolScheduleContracts.BindingModels;
+using SchoolScheduleContracts.SearchModels;
+using SchoolScheduleContracts.ViewModels;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SchoolScheduleContracts.BusinessLogicsContracts
+{
+ public interface IStudentLogic
+ {
+ List? ReadList(StudentSearchModel? model);
+ StudentViewModel? ReadElement(StudentSearchModel model);
+ bool Create(StudentBindingModel model);
+ bool Update(StudentBindingModel model);
+ bool Delete(StudentBindingModel model);
+ }
+}
diff --git a/SchoolSchedule/SchoolScheduleContracts/BusinessLogicsContracts/ISubjectLogic.cs b/SchoolSchedule/SchoolScheduleContracts/BusinessLogicsContracts/ISubjectLogic.cs
new file mode 100644
index 0000000..4b57ec0
--- /dev/null
+++ b/SchoolSchedule/SchoolScheduleContracts/BusinessLogicsContracts/ISubjectLogic.cs
@@ -0,0 +1,20 @@
+using SchoolScheduleContracts.BindingModels;
+using SchoolScheduleContracts.SearchModels;
+using SchoolScheduleContracts.ViewModels;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SchoolScheduleContracts.BusinessLogicsContracts
+{
+ public interface ISubjectLogic
+ {
+ List? ReadList(SubjectSearchModel? model);
+ SubjectViewModel? ReadElement(SubjectSearchModel model);
+ bool Create(SubjectBindingModel model);
+ bool Update(SubjectBindingModel model);
+ bool Delete(SubjectBindingModel model);
+ }
+}
diff --git a/SchoolSchedule/SchoolScheduleContracts/BusinessLogicsContracts/ITeacherLogic.cs b/SchoolSchedule/SchoolScheduleContracts/BusinessLogicsContracts/ITeacherLogic.cs
new file mode 100644
index 0000000..a0bf212
--- /dev/null
+++ b/SchoolSchedule/SchoolScheduleContracts/BusinessLogicsContracts/ITeacherLogic.cs
@@ -0,0 +1,20 @@
+using SchoolScheduleContracts.BindingModels;
+using SchoolScheduleContracts.SearchModels;
+using SchoolScheduleContracts.ViewModels;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SchoolScheduleContracts.BusinessLogicsContracts
+{
+ public interface ITeacherLogic
+ {
+ List? ReadList(TeacherSearchModel? model);
+ TeacherViewModel? ReadElement(TeacherSearchModel model);
+ bool Create(TeacherBindingModel model);
+ bool Update(TeacherBindingModel model);
+ bool Delete(TeacherBindingModel model);
+ }
+}
diff --git a/SchoolSchedule/SchoolScheduleContracts/SchoolScheduleContracts.csproj b/SchoolSchedule/SchoolScheduleContracts/SchoolScheduleContracts.csproj
new file mode 100644
index 0000000..a3bc238
--- /dev/null
+++ b/SchoolSchedule/SchoolScheduleContracts/SchoolScheduleContracts.csproj
@@ -0,0 +1,13 @@
+
+
+
+ net8.0
+ enable
+ enable
+
+
+
+
+
+
+
diff --git a/SchoolSchedule/SchoolScheduleContracts/SearchModels/GradeSearchModel.cs b/SchoolSchedule/SchoolScheduleContracts/SearchModels/GradeSearchModel.cs
new file mode 100644
index 0000000..730e0a6
--- /dev/null
+++ b/SchoolSchedule/SchoolScheduleContracts/SearchModels/GradeSearchModel.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SchoolScheduleContracts.SearchModels
+{
+ public class GradeSearchModel
+ {
+ public int? Id { get; set; }
+ public char? Letter { get; set; }
+ public int? Year { get; set; }
+ }
+}
diff --git a/SchoolSchedule/SchoolScheduleContracts/SearchModels/LessonSearchModel.cs b/SchoolSchedule/SchoolScheduleContracts/SearchModels/LessonSearchModel.cs
new file mode 100644
index 0000000..62c7629
--- /dev/null
+++ b/SchoolSchedule/SchoolScheduleContracts/SearchModels/LessonSearchModel.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SchoolScheduleContracts.SearchModels
+{
+ public class LessonSearchModel
+ {
+ public int? Id { get; set; }
+ public int? GradeId { get; set; }
+ public int? TeacherId { get; set; }
+ public int? SubjectId { get; set; }
+ public DateOnly? Date { get; set; }
+ public int? SchedulePlaceId { get; set; }
+ public DateOnly? DateFrom { get; set; }
+ public DateOnly? DateTo { get; set; }
+ }
+}
diff --git a/SchoolSchedule/SchoolScheduleContracts/SearchModels/SchedulePlaceSearchModel.cs b/SchoolSchedule/SchoolScheduleContracts/SearchModels/SchedulePlaceSearchModel.cs
new file mode 100644
index 0000000..49d518b
--- /dev/null
+++ b/SchoolSchedule/SchoolScheduleContracts/SearchModels/SchedulePlaceSearchModel.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SchoolScheduleContracts.SearchModels
+{
+ public class SchedulePlaceSearchModel
+ {
+ public int? Id { get; set; }
+ }
+}
diff --git a/SchoolSchedule/SchoolScheduleContracts/SearchModels/StudentSearchModel.cs b/SchoolSchedule/SchoolScheduleContracts/SearchModels/StudentSearchModel.cs
new file mode 100644
index 0000000..8a6874a
--- /dev/null
+++ b/SchoolSchedule/SchoolScheduleContracts/SearchModels/StudentSearchModel.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SchoolScheduleContracts.SearchModels
+{
+ public class StudentSearchModel
+ {
+ public int? Id { get; set; }
+ public int? GradeId { get; set; }
+ public string? FullName { get; set; }
+ }
+}
diff --git a/SchoolSchedule/SchoolScheduleContracts/SearchModels/SubjectSearchModel.cs b/SchoolSchedule/SchoolScheduleContracts/SearchModels/SubjectSearchModel.cs
new file mode 100644
index 0000000..91e494b
--- /dev/null
+++ b/SchoolSchedule/SchoolScheduleContracts/SearchModels/SubjectSearchModel.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SchoolScheduleContracts.SearchModels
+{
+ public class SubjectSearchModel
+ {
+ public int? Id { get; set; }
+ public string? SubjectName { get; set; }
+ }
+}
diff --git a/SchoolSchedule/SchoolScheduleContracts/SearchModels/TeacherSearchModel.cs b/SchoolSchedule/SchoolScheduleContracts/SearchModels/TeacherSearchModel.cs
new file mode 100644
index 0000000..2014477
--- /dev/null
+++ b/SchoolSchedule/SchoolScheduleContracts/SearchModels/TeacherSearchModel.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SchoolScheduleContracts.SearchModels
+{
+ public class TeacherSearchModel
+ {
+ public int? Id { get; set; }
+ public string? FullName { get; set; }
+ }
+}
diff --git a/SchoolSchedule/SchoolScheduleContracts/StoragesContracts/IGradeStorage.cs b/SchoolSchedule/SchoolScheduleContracts/StoragesContracts/IGradeStorage.cs
new file mode 100644
index 0000000..6faf056
--- /dev/null
+++ b/SchoolSchedule/SchoolScheduleContracts/StoragesContracts/IGradeStorage.cs
@@ -0,0 +1,22 @@
+using SchoolScheduleContracts.BindingModels;
+using SchoolScheduleContracts.SearchModels;
+using SchoolScheduleContracts.ViewModels;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SchoolScheduleContracts.StoragesContracts
+{
+ public interface IGradeStorage
+ {
+ List GetFullList();
+ List GetFilteredList(GradeSearchModel model);
+ GradeViewModel? GetElement(GradeSearchModel model);
+ GradeViewModel? Insert(GradeBindingModel model);
+ GradeViewModel? Update(GradeBindingModel model);
+ GradeViewModel? Delete(GradeBindingModel model);
+
+ }
+}
diff --git a/SchoolSchedule/SchoolScheduleContracts/StoragesContracts/ILessonStorage.cs b/SchoolSchedule/SchoolScheduleContracts/StoragesContracts/ILessonStorage.cs
new file mode 100644
index 0000000..b88b659
--- /dev/null
+++ b/SchoolSchedule/SchoolScheduleContracts/StoragesContracts/ILessonStorage.cs
@@ -0,0 +1,21 @@
+using SchoolScheduleContracts.BindingModels;
+using SchoolScheduleContracts.SearchModels;
+using SchoolScheduleContracts.ViewModels;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SchoolScheduleContracts.StoragesContracts
+{
+ public interface ILessonStorage
+ {
+ List GetFullList();
+ List GetFilteredList(LessonSearchModel model);
+ LessonViewModel? GetElement(LessonSearchModel model);
+ LessonViewModel? Insert(LessonBindingModel model);
+ LessonViewModel? Update(LessonBindingModel model);
+ LessonViewModel? Delete(LessonBindingModel model);
+ }
+}
diff --git a/SchoolSchedule/SchoolScheduleContracts/StoragesContracts/ISchedulePlaceStorage.cs b/SchoolSchedule/SchoolScheduleContracts/StoragesContracts/ISchedulePlaceStorage.cs
new file mode 100644
index 0000000..f9e449f
--- /dev/null
+++ b/SchoolSchedule/SchoolScheduleContracts/StoragesContracts/ISchedulePlaceStorage.cs
@@ -0,0 +1,21 @@
+using SchoolScheduleContracts.BindingModels;
+using SchoolScheduleContracts.SearchModels;
+using SchoolScheduleContracts.ViewModels;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SchoolScheduleContracts.StoragesContracts
+{
+ public interface ISchedulePlaceStorage
+ {
+ List GetFullList();
+ List GetFilteredList(SchedulePlaceSearchModel model);
+ SchedulePlaceViewModel? GetElement(SchedulePlaceSearchModel model);
+ SchedulePlaceViewModel? Insert(SchedulePlaceBindingModel model);
+ SchedulePlaceViewModel? Update(SchedulePlaceBindingModel model);
+ SchedulePlaceViewModel? Delete(SchedulePlaceBindingModel model);
+ }
+}
diff --git a/SchoolSchedule/SchoolScheduleContracts/StoragesContracts/IStudentStorage.cs b/SchoolSchedule/SchoolScheduleContracts/StoragesContracts/IStudentStorage.cs
new file mode 100644
index 0000000..1c0c17c
--- /dev/null
+++ b/SchoolSchedule/SchoolScheduleContracts/StoragesContracts/IStudentStorage.cs
@@ -0,0 +1,21 @@
+using SchoolScheduleContracts.BindingModels;
+using SchoolScheduleContracts.SearchModels;
+using SchoolScheduleContracts.ViewModels;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SchoolScheduleContracts.StoragesContracts
+{
+ public interface IStudentStorage
+ {
+ List GetFullList();
+ List GetFilteredList(StudentSearchModel model);
+ StudentViewModel? GetElement(StudentSearchModel model);
+ StudentViewModel? Insert(StudentBindingModel model);
+ StudentViewModel? Update(StudentBindingModel model);
+ StudentViewModel? Delete(StudentBindingModel model);
+ }
+}
diff --git a/SchoolSchedule/SchoolScheduleContracts/StoragesContracts/ISubjectStorage.cs b/SchoolSchedule/SchoolScheduleContracts/StoragesContracts/ISubjectStorage.cs
new file mode 100644
index 0000000..b059bea
--- /dev/null
+++ b/SchoolSchedule/SchoolScheduleContracts/StoragesContracts/ISubjectStorage.cs
@@ -0,0 +1,21 @@
+using SchoolScheduleContracts.BindingModels;
+using SchoolScheduleContracts.SearchModels;
+using SchoolScheduleContracts.ViewModels;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SchoolScheduleContracts.StoragesContracts
+{
+ public interface ISubjectStorage
+ {
+ List GetFullList();
+ List GetFilteredList(SubjectSearchModel model);
+ SubjectViewModel? GetElement(SubjectSearchModel model);
+ SubjectViewModel? Insert(SubjectBindingModel model);
+ SubjectViewModel? Update(SubjectBindingModel model);
+ SubjectViewModel? Delete(SubjectBindingModel model);
+ }
+}
diff --git a/SchoolSchedule/SchoolScheduleContracts/StoragesContracts/ITeacherStorage.cs b/SchoolSchedule/SchoolScheduleContracts/StoragesContracts/ITeacherStorage.cs
new file mode 100644
index 0000000..b3cf7fe
--- /dev/null
+++ b/SchoolSchedule/SchoolScheduleContracts/StoragesContracts/ITeacherStorage.cs
@@ -0,0 +1,21 @@
+using SchoolScheduleContracts.BindingModels;
+using SchoolScheduleContracts.SearchModels;
+using SchoolScheduleContracts.ViewModels;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SchoolScheduleContracts.StoragesContracts
+{
+ public interface ITeacherStorage
+ {
+ List GetFullList();
+ List GetFilteredList(TeacherSearchModel model);
+ TeacherViewModel? GetElement(TeacherSearchModel model);
+ TeacherViewModel? Insert(TeacherBindingModel model);
+ TeacherViewModel? Update(TeacherBindingModel model);
+ TeacherViewModel? Delete(TeacherBindingModel model);
+ }
+}
diff --git a/SchoolSchedule/SchoolScheduleContracts/ViewModels/GradeViewModel.cs b/SchoolSchedule/SchoolScheduleContracts/ViewModels/GradeViewModel.cs
new file mode 100644
index 0000000..e27fd45
--- /dev/null
+++ b/SchoolSchedule/SchoolScheduleContracts/ViewModels/GradeViewModel.cs
@@ -0,0 +1,22 @@
+using SchoolScheduleDataModels.Models;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SchoolScheduleContracts.ViewModels
+{
+ public class GradeViewModel : IGradeModel
+ {
+ public int Id { get; set; }
+ [DisplayName("Год")]
+ public int Year { get; set; }
+ [DisplayName("Буква")]
+ public char Letter { get; set; }
+ public int TeacherId { get; set; }
+ [DisplayName("Классный руководитель")]
+ public string TeacherFullName { get; set; }
+ }
+}
diff --git a/SchoolSchedule/SchoolScheduleContracts/ViewModels/LessonViewModel.cs b/SchoolSchedule/SchoolScheduleContracts/ViewModels/LessonViewModel.cs
new file mode 100644
index 0000000..dea2dd3
--- /dev/null
+++ b/SchoolSchedule/SchoolScheduleContracts/ViewModels/LessonViewModel.cs
@@ -0,0 +1,31 @@
+using SchoolScheduleDataModels.Models;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SchoolScheduleContracts.ViewModels
+{
+ public class LessonViewModel : ILessonModel
+ {
+ public int Id { get; set; }
+ [DisplayName("Дата")]
+ public DateOnly Date { get; set; }
+ [DisplayName("Домашняя работа")]
+ public string? Homework { get; set; }
+ public int SchedulePlaceId { get; set; }
+ [DisplayName("Время")]
+ public TimeOnly SchedulePlaceTime { get; set; } = TimeOnly.MinValue;
+ public int TeacherId { get; set; }
+ public int SubjectId { get; set; }
+ public int GradeId { get; set; }
+ [DisplayName("Учитель")]
+ public string TeacherFullName { get; set; } = string.Empty;
+ [DisplayName("Предмет")]
+ public string SubjectName { get; set; } = string.Empty;
+ [DisplayName("Класс")]
+ public string GradeName { get; set; } = string.Empty;
+ }
+}
diff --git a/SchoolSchedule/SchoolScheduleContracts/ViewModels/SchedulePlaceViewModel.cs b/SchoolSchedule/SchoolScheduleContracts/ViewModels/SchedulePlaceViewModel.cs
new file mode 100644
index 0000000..326e81a
--- /dev/null
+++ b/SchoolSchedule/SchoolScheduleContracts/ViewModels/SchedulePlaceViewModel.cs
@@ -0,0 +1,17 @@
+using SchoolScheduleDataModels.Models;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SchoolScheduleContracts.ViewModels
+{
+ public class SchedulePlaceViewModel : ISchedulePlaceModel
+ {
+ public int Id { get; set; }
+ [DisplayName("Время")]
+ public TimeOnly Time { get; set; }
+ }
+}
diff --git a/SchoolSchedule/SchoolScheduleContracts/ViewModels/StudentViewModel.cs b/SchoolSchedule/SchoolScheduleContracts/ViewModels/StudentViewModel.cs
new file mode 100644
index 0000000..aa0cc36
--- /dev/null
+++ b/SchoolSchedule/SchoolScheduleContracts/ViewModels/StudentViewModel.cs
@@ -0,0 +1,22 @@
+using SchoolScheduleDataModels.Enums;
+using SchoolScheduleDataModels.Models;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SchoolScheduleContracts.ViewModels
+{
+ public class StudentViewModel : IStudentModel
+ {
+ public int Id { get; set; }
+ [DisplayName("Полное имя")]
+ public string FullName { get; set; } = string.Empty;
+ public int GradeId { get; set; }
+ [DisplayName("Класс")]
+ public string GradeName { get; set; } = string.Empty;
+ public Dictionary Attendance { get; set; } = new();
+ }
+}
diff --git a/SchoolSchedule/SchoolScheduleContracts/ViewModels/SubjectViewModel.cs b/SchoolSchedule/SchoolScheduleContracts/ViewModels/SubjectViewModel.cs
new file mode 100644
index 0000000..8da499c
--- /dev/null
+++ b/SchoolSchedule/SchoolScheduleContracts/ViewModels/SubjectViewModel.cs
@@ -0,0 +1,17 @@
+using SchoolScheduleDataModels.Models;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SchoolScheduleContracts.ViewModels
+{
+ public class SubjectViewModel : ISubjectModel
+ {
+ public int Id { get; set; }
+ [DisplayName("Название")]
+ public string SubjectName { get; set; } = string.Empty;
+ }
+}
diff --git a/SchoolSchedule/SchoolScheduleContracts/ViewModels/TeacherViewModel.cs b/SchoolSchedule/SchoolScheduleContracts/ViewModels/TeacherViewModel.cs
new file mode 100644
index 0000000..3e8fc0b
--- /dev/null
+++ b/SchoolSchedule/SchoolScheduleContracts/ViewModels/TeacherViewModel.cs
@@ -0,0 +1,17 @@
+using SchoolScheduleDataModels.Models;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SchoolScheduleContracts.ViewModels
+{
+ public class TeacherViewModel : ITeacherModel
+ {
+ public int Id { get; set; }
+ [DisplayName("Полное имя")]
+ public string FullName { get; set; } = string.Empty;
+ }
+}
diff --git a/SchoolSchedule/SchoolScheduleDataBaseImplement/Migrations/20240408103656_InitialCreate.Designer.cs b/SchoolSchedule/SchoolScheduleDataBaseImplement/Migrations/20240408103656_InitialCreate.Designer.cs
new file mode 100644
index 0000000..82a864c
--- /dev/null
+++ b/SchoolSchedule/SchoolScheduleDataBaseImplement/Migrations/20240408103656_InitialCreate.Designer.cs
@@ -0,0 +1,312 @@
+//
+using System;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using SchoolScheduleDataBaseImplement;
+
+#nullable disable
+
+namespace SchoolScheduleDataBaseImplement.Migrations
+{
+ [DbContext(typeof(SchoolScheduleDataBase))]
+ [Migration("20240408103656_InitialCreate")]
+ partial class InitialCreate
+ {
+ ///
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "8.0.3")
+ .HasAnnotation("Relational:MaxIdentifierLength", 128);
+
+ SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
+
+ modelBuilder.Entity("SchoolScheduleDataBaseImplement.Models.Grade", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("Letter")
+ .IsRequired()
+ .HasColumnType("nvarchar(1)");
+
+ b.Property("TeacherId")
+ .HasColumnType("int");
+
+ b.Property("Year")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.ToTable("Grades");
+ });
+
+ modelBuilder.Entity("SchoolScheduleDataBaseImplement.Models.Lesson", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("Date")
+ .HasColumnType("date");
+
+ b.Property("GradeId")
+ .HasColumnType("int");
+
+ b.Property("Homework")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("SchedulePlaceId")
+ .HasColumnType("int");
+
+ b.Property("SubjectId")
+ .HasColumnType("int");
+
+ b.Property("TeacherId")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.HasIndex("GradeId");
+
+ b.HasIndex("SchedulePlaceId");
+
+ b.HasIndex("SubjectId");
+
+ b.HasIndex("TeacherId");
+
+ b.ToTable("Lessons");
+ });
+
+ modelBuilder.Entity("SchoolScheduleDataBaseImplement.Models.LessonStudent", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("LessonId")
+ .HasColumnType("int");
+
+ b.Property("Mark")
+ .IsRequired()
+ .HasColumnType("int");
+
+ b.Property("Status")
+ .HasColumnType("int");
+
+ b.Property("StudentId")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.HasIndex("LessonId");
+
+ b.HasIndex("StudentId");
+
+ b.ToTable("LessonStudents");
+ });
+
+ modelBuilder.Entity("SchoolScheduleDataBaseImplement.Models.SchedulePlace", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("Time")
+ .HasColumnType("time");
+
+ b.HasKey("Id");
+
+ b.ToTable("SchedulePlaces");
+ });
+
+ modelBuilder.Entity("SchoolScheduleDataBaseImplement.Models.Student", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("FullName")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("GradeId")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.HasIndex("GradeId");
+
+ b.ToTable("Students");
+ });
+
+ modelBuilder.Entity("SchoolScheduleDataBaseImplement.Models.Subject", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("SubjectName")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("Id");
+
+ b.ToTable("Subjects");
+ });
+
+ modelBuilder.Entity("SchoolScheduleDataBaseImplement.Models.Teacher", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("FullName")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("TeacherId")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.HasIndex("TeacherId")
+ .IsUnique();
+
+ b.ToTable("Teachers");
+ });
+
+ modelBuilder.Entity("SchoolScheduleDataBaseImplement.Models.Lesson", b =>
+ {
+ b.HasOne("SchoolScheduleDataBaseImplement.Models.Grade", "Grade")
+ .WithMany("Lessons")
+ .HasForeignKey("GradeId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("SchoolScheduleDataBaseImplement.Models.SchedulePlace", "SchedulePlace")
+ .WithMany("Lessons")
+ .HasForeignKey("SchedulePlaceId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("SchoolScheduleDataBaseImplement.Models.Subject", "Subject")
+ .WithMany("Lessons")
+ .HasForeignKey("SubjectId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("SchoolScheduleDataBaseImplement.Models.Teacher", "Teacher")
+ .WithMany("Lessons")
+ .HasForeignKey("TeacherId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Grade");
+
+ b.Navigation("SchedulePlace");
+
+ b.Navigation("Subject");
+
+ b.Navigation("Teacher");
+ });
+
+ modelBuilder.Entity("SchoolScheduleDataBaseImplement.Models.LessonStudent", b =>
+ {
+ b.HasOne("SchoolScheduleDataBaseImplement.Models.Lesson", "Lesson")
+ .WithMany("Students")
+ .HasForeignKey("LessonId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("SchoolScheduleDataBaseImplement.Models.Student", "Student")
+ .WithMany("Lessons")
+ .HasForeignKey("StudentId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Lesson");
+
+ b.Navigation("Student");
+ });
+
+ modelBuilder.Entity("SchoolScheduleDataBaseImplement.Models.Student", b =>
+ {
+ b.HasOne("SchoolScheduleDataBaseImplement.Models.Grade", "Grade")
+ .WithMany("Students")
+ .HasForeignKey("GradeId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Grade");
+ });
+
+ modelBuilder.Entity("SchoolScheduleDataBaseImplement.Models.Teacher", b =>
+ {
+ b.HasOne("SchoolScheduleDataBaseImplement.Models.Grade", "Grade")
+ .WithOne("Teacher")
+ .HasForeignKey("SchoolScheduleDataBaseImplement.Models.Teacher", "TeacherId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Grade");
+ });
+
+ modelBuilder.Entity("SchoolScheduleDataBaseImplement.Models.Grade", b =>
+ {
+ b.Navigation("Lessons");
+
+ b.Navigation("Students");
+
+ b.Navigation("Teacher")
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("SchoolScheduleDataBaseImplement.Models.Lesson", b =>
+ {
+ b.Navigation("Students");
+ });
+
+ modelBuilder.Entity("SchoolScheduleDataBaseImplement.Models.SchedulePlace", b =>
+ {
+ b.Navigation("Lessons");
+ });
+
+ modelBuilder.Entity("SchoolScheduleDataBaseImplement.Models.Student", b =>
+ {
+ b.Navigation("Lessons");
+ });
+
+ modelBuilder.Entity("SchoolScheduleDataBaseImplement.Models.Subject", b =>
+ {
+ b.Navigation("Lessons");
+ });
+
+ modelBuilder.Entity("SchoolScheduleDataBaseImplement.Models.Teacher", b =>
+ {
+ b.Navigation("Lessons");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/SchoolSchedule/SchoolScheduleDataBaseImplement/Migrations/20240408103656_InitialCreate.cs b/SchoolSchedule/SchoolScheduleDataBaseImplement/Migrations/20240408103656_InitialCreate.cs
new file mode 100644
index 0000000..573c80b
--- /dev/null
+++ b/SchoolSchedule/SchoolScheduleDataBaseImplement/Migrations/20240408103656_InitialCreate.cs
@@ -0,0 +1,232 @@
+using System;
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace SchoolScheduleDataBaseImplement.Migrations
+{
+ ///
+ public partial class InitialCreate : Migration
+ {
+ ///
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.CreateTable(
+ name: "Grades",
+ columns: table => new
+ {
+ Id = table.Column(type: "int", nullable: false)
+ .Annotation("SqlServer:Identity", "1, 1"),
+ Year = table.Column(type: "int", nullable: false),
+ Letter = table.Column(type: "nvarchar(1)", nullable: false),
+ TeacherId = table.Column(type: "int", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Grades", x => x.Id);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "SchedulePlaces",
+ columns: table => new
+ {
+ Id = table.Column(type: "int", nullable: false)
+ .Annotation("SqlServer:Identity", "1, 1"),
+ Time = table.Column(type: "time", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_SchedulePlaces", x => x.Id);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "Subjects",
+ columns: table => new
+ {
+ Id = table.Column(type: "int", nullable: false)
+ .Annotation("SqlServer:Identity", "1, 1"),
+ SubjectName = table.Column(type: "nvarchar(max)", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Subjects", x => x.Id);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "Students",
+ columns: table => new
+ {
+ Id = table.Column(type: "int", nullable: false)
+ .Annotation("SqlServer:Identity", "1, 1"),
+ FullName = table.Column(type: "nvarchar(max)", nullable: false),
+ GradeId = table.Column(type: "int", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Students", x => x.Id);
+ table.ForeignKey(
+ name: "FK_Students_Grades_GradeId",
+ column: x => x.GradeId,
+ principalTable: "Grades",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "Teachers",
+ columns: table => new
+ {
+ Id = table.Column(type: "int", nullable: false)
+ .Annotation("SqlServer:Identity", "1, 1"),
+ FullName = table.Column(type: "nvarchar(max)", nullable: false),
+ TeacherId = table.Column(type: "int", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Teachers", x => x.Id);
+ table.ForeignKey(
+ name: "FK_Teachers_Grades_TeacherId",
+ column: x => x.TeacherId,
+ principalTable: "Grades",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "Lessons",
+ columns: table => new
+ {
+ Id = table.Column(type: "int", nullable: false)
+ .Annotation("SqlServer:Identity", "1, 1"),
+ Date = table.Column(type: "date", nullable: false),
+ Homework = table.Column(type: "nvarchar(max)", nullable: false),
+ SchedulePlaceId = table.Column(type: "int", nullable: false),
+ TeacherId = table.Column(type: "int", nullable: false),
+ SubjectId = table.Column(type: "int", nullable: false),
+ GradeId = table.Column(type: "int", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Lessons", x => x.Id);
+ table.ForeignKey(
+ name: "FK_Lessons_Grades_GradeId",
+ column: x => x.GradeId,
+ principalTable: "Grades",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ table.ForeignKey(
+ name: "FK_Lessons_SchedulePlaces_SchedulePlaceId",
+ column: x => x.SchedulePlaceId,
+ principalTable: "SchedulePlaces",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ table.ForeignKey(
+ name: "FK_Lessons_Subjects_SubjectId",
+ column: x => x.SubjectId,
+ principalTable: "Subjects",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ table.ForeignKey(
+ name: "FK_Lessons_Teachers_TeacherId",
+ column: x => x.TeacherId,
+ principalTable: "Teachers",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Restrict);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "LessonStudents",
+ columns: table => new
+ {
+ Id = table.Column(type: "int", nullable: false)
+ .Annotation("SqlServer:Identity", "1, 1"),
+ StudentId = table.Column(type: "int", nullable: false),
+ LessonId = table.Column(type: "int", nullable: false),
+ Status = table.Column(type: "int", nullable: false),
+ Mark = table.Column(type: "int", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_LessonStudents", x => x.Id);
+ table.ForeignKey(
+ name: "FK_LessonStudents_Lessons_LessonId",
+ column: x => x.LessonId,
+ principalTable: "Lessons",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ table.ForeignKey(
+ name: "FK_LessonStudents_Students_StudentId",
+ column: x => x.StudentId,
+ principalTable: "Students",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Restrict);
+ });
+
+ migrationBuilder.CreateIndex(
+ name: "IX_Lessons_GradeId",
+ table: "Lessons",
+ column: "GradeId");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_Lessons_SchedulePlaceId",
+ table: "Lessons",
+ column: "SchedulePlaceId");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_Lessons_SubjectId",
+ table: "Lessons",
+ column: "SubjectId");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_Lessons_TeacherId",
+ table: "Lessons",
+ column: "TeacherId");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_LessonStudents_LessonId",
+ table: "LessonStudents",
+ column: "LessonId");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_LessonStudents_StudentId",
+ table: "LessonStudents",
+ column: "StudentId");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_Students_GradeId",
+ table: "Students",
+ column: "GradeId");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_Teachers_TeacherId",
+ table: "Teachers",
+ column: "TeacherId",
+ unique: true);
+ }
+
+ ///
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropTable(
+ name: "LessonStudents");
+
+ migrationBuilder.DropTable(
+ name: "Lessons");
+
+ migrationBuilder.DropTable(
+ name: "Students");
+
+ migrationBuilder.DropTable(
+ name: "SchedulePlaces");
+
+ migrationBuilder.DropTable(
+ name: "Subjects");
+
+ migrationBuilder.DropTable(
+ name: "Teachers");
+
+ migrationBuilder.DropTable(
+ name: "Grades");
+ }
+ }
+}
diff --git a/SchoolSchedule/SchoolScheduleDataBaseImplement/Migrations/SchoolScheduleDataBaseModelSnapshot.cs b/SchoolSchedule/SchoolScheduleDataBaseImplement/Migrations/SchoolScheduleDataBaseModelSnapshot.cs
new file mode 100644
index 0000000..05742b4
--- /dev/null
+++ b/SchoolSchedule/SchoolScheduleDataBaseImplement/Migrations/SchoolScheduleDataBaseModelSnapshot.cs
@@ -0,0 +1,309 @@
+//
+using System;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using SchoolScheduleDataBaseImplement;
+
+#nullable disable
+
+namespace SchoolScheduleDataBaseImplement.Migrations
+{
+ [DbContext(typeof(SchoolScheduleDataBase))]
+ partial class SchoolScheduleDataBaseModelSnapshot : ModelSnapshot
+ {
+ protected override void BuildModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "8.0.3")
+ .HasAnnotation("Relational:MaxIdentifierLength", 128);
+
+ SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
+
+ modelBuilder.Entity("SchoolScheduleDataBaseImplement.Models.Grade", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("Letter")
+ .IsRequired()
+ .HasColumnType("nvarchar(1)");
+
+ b.Property("TeacherId")
+ .HasColumnType("int");
+
+ b.Property("Year")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.ToTable("Grades");
+ });
+
+ modelBuilder.Entity("SchoolScheduleDataBaseImplement.Models.Lesson", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("Date")
+ .HasColumnType("date");
+
+ b.Property("GradeId")
+ .HasColumnType("int");
+
+ b.Property("Homework")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("SchedulePlaceId")
+ .HasColumnType("int");
+
+ b.Property("SubjectId")
+ .HasColumnType("int");
+
+ b.Property("TeacherId")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.HasIndex("GradeId");
+
+ b.HasIndex("SchedulePlaceId");
+
+ b.HasIndex("SubjectId");
+
+ b.HasIndex("TeacherId");
+
+ b.ToTable("Lessons");
+ });
+
+ modelBuilder.Entity("SchoolScheduleDataBaseImplement.Models.LessonStudent", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("LessonId")
+ .HasColumnType("int");
+
+ b.Property("Mark")
+ .IsRequired()
+ .HasColumnType("int");
+
+ b.Property("Status")
+ .HasColumnType("int");
+
+ b.Property("StudentId")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.HasIndex("LessonId");
+
+ b.HasIndex("StudentId");
+
+ b.ToTable("LessonStudents");
+ });
+
+ modelBuilder.Entity("SchoolScheduleDataBaseImplement.Models.SchedulePlace", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("Time")
+ .HasColumnType("time");
+
+ b.HasKey("Id");
+
+ b.ToTable("SchedulePlaces");
+ });
+
+ modelBuilder.Entity("SchoolScheduleDataBaseImplement.Models.Student", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("FullName")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("GradeId")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.HasIndex("GradeId");
+
+ b.ToTable("Students");
+ });
+
+ modelBuilder.Entity("SchoolScheduleDataBaseImplement.Models.Subject", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("SubjectName")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("Id");
+
+ b.ToTable("Subjects");
+ });
+
+ modelBuilder.Entity("SchoolScheduleDataBaseImplement.Models.Teacher", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("FullName")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("TeacherId")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.HasIndex("TeacherId")
+ .IsUnique();
+
+ b.ToTable("Teachers");
+ });
+
+ modelBuilder.Entity("SchoolScheduleDataBaseImplement.Models.Lesson", b =>
+ {
+ b.HasOne("SchoolScheduleDataBaseImplement.Models.Grade", "Grade")
+ .WithMany("Lessons")
+ .HasForeignKey("GradeId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("SchoolScheduleDataBaseImplement.Models.SchedulePlace", "SchedulePlace")
+ .WithMany("Lessons")
+ .HasForeignKey("SchedulePlaceId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("SchoolScheduleDataBaseImplement.Models.Subject", "Subject")
+ .WithMany("Lessons")
+ .HasForeignKey("SubjectId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("SchoolScheduleDataBaseImplement.Models.Teacher", "Teacher")
+ .WithMany("Lessons")
+ .HasForeignKey("TeacherId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Grade");
+
+ b.Navigation("SchedulePlace");
+
+ b.Navigation("Subject");
+
+ b.Navigation("Teacher");
+ });
+
+ modelBuilder.Entity("SchoolScheduleDataBaseImplement.Models.LessonStudent", b =>
+ {
+ b.HasOne("SchoolScheduleDataBaseImplement.Models.Lesson", "Lesson")
+ .WithMany("Students")
+ .HasForeignKey("LessonId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("SchoolScheduleDataBaseImplement.Models.Student", "Student")
+ .WithMany("Lessons")
+ .HasForeignKey("StudentId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Lesson");
+
+ b.Navigation("Student");
+ });
+
+ modelBuilder.Entity("SchoolScheduleDataBaseImplement.Models.Student", b =>
+ {
+ b.HasOne("SchoolScheduleDataBaseImplement.Models.Grade", "Grade")
+ .WithMany("Students")
+ .HasForeignKey("GradeId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Grade");
+ });
+
+ modelBuilder.Entity("SchoolScheduleDataBaseImplement.Models.Teacher", b =>
+ {
+ b.HasOne("SchoolScheduleDataBaseImplement.Models.Grade", "Grade")
+ .WithOne("Teacher")
+ .HasForeignKey("SchoolScheduleDataBaseImplement.Models.Teacher", "TeacherId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Grade");
+ });
+
+ modelBuilder.Entity("SchoolScheduleDataBaseImplement.Models.Grade", b =>
+ {
+ b.Navigation("Lessons");
+
+ b.Navigation("Students");
+
+ b.Navigation("Teacher")
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("SchoolScheduleDataBaseImplement.Models.Lesson", b =>
+ {
+ b.Navigation("Students");
+ });
+
+ modelBuilder.Entity("SchoolScheduleDataBaseImplement.Models.SchedulePlace", b =>
+ {
+ b.Navigation("Lessons");
+ });
+
+ modelBuilder.Entity("SchoolScheduleDataBaseImplement.Models.Student", b =>
+ {
+ b.Navigation("Lessons");
+ });
+
+ modelBuilder.Entity("SchoolScheduleDataBaseImplement.Models.Subject", b =>
+ {
+ b.Navigation("Lessons");
+ });
+
+ modelBuilder.Entity("SchoolScheduleDataBaseImplement.Models.Teacher", b =>
+ {
+ b.Navigation("Lessons");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/SchoolSchedule/SchoolScheduleDataBaseImplement/Models/Grade.cs b/SchoolSchedule/SchoolScheduleDataBaseImplement/Models/Grade.cs
new file mode 100644
index 0000000..9439cf4
--- /dev/null
+++ b/SchoolSchedule/SchoolScheduleDataBaseImplement/Models/Grade.cs
@@ -0,0 +1,66 @@
+using SchoolScheduleContracts.BindingModels;
+using SchoolScheduleContracts.ViewModels;
+using SchoolScheduleDataModels.Models;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SchoolScheduleDataBaseImplement.Models
+{
+ public class Grade : IGradeModel
+ {
+ public int Id { get; private set; }
+ [Required]
+ public int Year { get; private set; }
+ [Required]
+ public char Letter { get; private set; }
+ [Required]
+ public int TeacherId { get; private set; }
+ [ForeignKey("GradeId")]
+ public virtual List Students { get; set; } =
+new();
+ [ForeignKey("GradeId")]
+ public virtual List Lessons { get; set; } =
+new();
+ public virtual Teacher Teacher { get; set; } = new();
+ public static Grade? Create(SchoolScheduleDataBase context, GradeBindingModel model)
+ {
+ if (model == null)
+ {
+ return null;
+ }
+ return new Grade()
+ {
+ Id = model.Id,
+ Year = model.Year,
+ TeacherId = model.TeacherId,
+ Letter = model.Letter
+ };
+ }
+ public void Update(SchoolScheduleDataBase context, GradeBindingModel model)
+ {
+ if (model == null)
+ {
+ return;
+ }
+ Year = model.Year;
+ Letter = model.Letter;
+ TeacherId = model.TeacherId;
+ Teacher = context.Teachers.First(x => x.Id == TeacherId);
+ }
+ public GradeViewModel GetViewModel => new()
+ {
+ Id = Id,
+ Year = Year,
+ Letter = Letter,
+ TeacherId = TeacherId,
+ TeacherFullName = Teacher.FullName
+ };
+
+ }
+}
diff --git a/SchoolSchedule/SchoolScheduleDataBaseImplement/Models/Lesson.cs b/SchoolSchedule/SchoolScheduleDataBaseImplement/Models/Lesson.cs
new file mode 100644
index 0000000..c2ba7f4
--- /dev/null
+++ b/SchoolSchedule/SchoolScheduleDataBaseImplement/Models/Lesson.cs
@@ -0,0 +1,85 @@
+using SchoolScheduleContracts.BindingModels;
+using SchoolScheduleContracts.ViewModels;
+using SchoolScheduleDataModels.Models;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SchoolScheduleDataBaseImplement.Models
+{
+ public class Lesson : ILessonModel
+ {
+ public int Id { get; private set; }
+ [Required]
+ public DateOnly Date { get; private set; }
+ [Required]
+ public string? Homework { get; private set; } = null;
+ [Required]
+ public int SchedulePlaceId { get; private set; }
+ [Required]
+ public int TeacherId { get; private set; }
+ [Required]
+ public int SubjectId { get; private set; }
+ [Required]
+ public int GradeId { get; private set; }
+ [ForeignKey("LessonId")]
+ public virtual List Students { get; set; } = new();
+ public virtual SchedulePlace SchedulePlace { get; set; } = new();
+ public virtual Teacher Teacher { get; set; } = new();
+ public virtual Subject Subject { get; set; } = new();
+ public virtual Grade Grade { get; set; } = new();
+
+ public static Lesson Create(SchoolScheduleDataBase context, LessonViewModel model)
+ {
+ return new Lesson
+ {
+ Id = model.Id,
+ Date = model.Date,
+ Homework = model.Homework,
+ SchedulePlaceId = model.SchedulePlaceId,
+ SchedulePlace = context.SchedulePlaces.First(y => y.Id == model.SchedulePlaceId),
+ TeacherId = model.TeacherId,
+ SubjectId = model.SubjectId,
+ GradeId = model.GradeId,
+ Teacher = context.Teachers.First(x => x.Id == model.TeacherId),
+ Subject = context.Subjects.First(x => x.Id == model.SubjectId),
+ Grade = context.Grades.First(x => x.Id == model.GradeId)
+ };
+ }
+ public void Update(SchoolScheduleDataBase context, LessonBindingModel model)
+ {
+ if (model == null)
+ {
+ return;
+ }
+ Date = model.Date;
+ Homework = model.Homework;
+ SchedulePlaceId = model.SchedulePlaceId;
+ SchedulePlace = context.SchedulePlaces.First(y => y.Id == model.SchedulePlaceId);
+ TeacherId = model.TeacherId;
+ SubjectId = model.SubjectId;
+ GradeId = model.GradeId;
+ Teacher = context.Teachers.First(x => x.Id == model.TeacherId);
+ Subject = context.Subjects.First(x => x.Id == model.SubjectId);
+ Grade = context.Grades.First(x => x.Id == model.GradeId);
+ }
+ public LessonViewModel GetViewModel => new()
+ {
+ Id = Id,
+ Date = Date,
+ Homework = Homework,
+ SchedulePlaceId = SchedulePlaceId,
+ SchedulePlaceTime = SchedulePlace.Time,
+ TeacherFullName = Teacher.FullName,
+ SubjectName = Subject.SubjectName,
+ GradeName = Grade.Year.ToString() + Grade.Letter.ToString()
+
+ };
+
+ }
+}
diff --git a/SchoolSchedule/SchoolScheduleDataBaseImplement/Models/LessonStudent.cs b/SchoolSchedule/SchoolScheduleDataBaseImplement/Models/LessonStudent.cs
new file mode 100644
index 0000000..0f39e00
--- /dev/null
+++ b/SchoolSchedule/SchoolScheduleDataBaseImplement/Models/LessonStudent.cs
@@ -0,0 +1,25 @@
+using SchoolScheduleDataModels.Enums;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SchoolScheduleDataBaseImplement.Models
+{
+ public class LessonStudent
+ {
+ public int Id { get; private set; }
+ [Required]
+ public int StudentId { get; private set; }
+ [Required]
+ public int LessonId { get; private set; }
+ [Required]
+ public StudentStatus Status { get; set; }
+ [Required]
+ public int? Mark { get; set; } = null;
+ public virtual Student Student { get; set; } = new();
+ public virtual Lesson Lesson { get; set; } = new();
+ }
+}
diff --git a/SchoolSchedule/SchoolScheduleDataBaseImplement/Models/SchedulePlace.cs b/SchoolSchedule/SchoolScheduleDataBaseImplement/Models/SchedulePlace.cs
new file mode 100644
index 0000000..2d3ac97
--- /dev/null
+++ b/SchoolSchedule/SchoolScheduleDataBaseImplement/Models/SchedulePlace.cs
@@ -0,0 +1,40 @@
+using SchoolScheduleContracts.BindingModels;
+using SchoolScheduleContracts.ViewModels;
+using SchoolScheduleDataModels.Models;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SchoolScheduleDataBaseImplement.Models
+{
+ public class SchedulePlace : ISchedulePlaceModel
+ {
+ public int Id { get; private set; }
+ [Required]
+ public TimeOnly Time { get; private set; }
+ [ForeignKey("SchedulePlaceId")]
+ public virtual List Lessons { get; set; } = new();
+ public static SchedulePlace Create(SchedulePlaceViewModel model)
+ {
+ return new SchedulePlace
+ {
+ Id = model.Id,
+ Time = model.Time,
+ };
+ }
+ public void Update(SchedulePlaceBindingModel model)
+ {
+ Time = model.Time;
+ }
+ public SchedulePlaceViewModel GetViewModel => new()
+ {
+ Id = Id,
+ Time = Time
+ };
+ }
+}
diff --git a/SchoolSchedule/SchoolScheduleDataBaseImplement/Models/Student.cs b/SchoolSchedule/SchoolScheduleDataBaseImplement/Models/Student.cs
new file mode 100644
index 0000000..72871b8
--- /dev/null
+++ b/SchoolSchedule/SchoolScheduleDataBaseImplement/Models/Student.cs
@@ -0,0 +1,97 @@
+using SchoolScheduleContracts.BindingModels;
+using SchoolScheduleContracts.ViewModels;
+using SchoolScheduleDataModels.Enums;
+using SchoolScheduleDataModels.Models;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SchoolScheduleDataBaseImplement.Models
+{
+ public class Student : IStudentModel
+ {
+ public int Id { get; private set; }
+ [Required]
+ public string FullName { get; private set; }
+ [Required]
+ public int GradeId { get; private set; }
+ public virtual Grade Grade { get; set; } = new();
+ private Dictionary _attendance = null;
+ [NotMapped]
+ public Dictionary Attendance
+ {
+ get
+ {
+ if (_attendance == null)
+ {
+ _attendance = Lessons.ToDictionary(recPC => recPC.LessonId, recPC =>
+ (recPC.Lesson as ILessonModel, recPC.Status, recPC.Mark));
+ }
+ return _attendance;
+ }
+ }
+ [ForeignKey("StudentId")]
+ public virtual List Lessons { get; set; } = new();
+
+ public static Student Create(SchoolScheduleDataBase context, StudentBindingModel model)
+ {
+ return new Student()
+ {
+ Id = model.Id,
+ FullName = model.FullName,
+ GradeId = model.GradeId,
+ Grade = context.Grades.First(y => y.Id == model.GradeId),
+ Lessons = model.Attendance.Select(x => new LessonStudent
+ {
+ Lesson = context.Lessons.First(y => y.Id == x.Key),
+ Status = x.Value.Item2,
+ Mark = x.Value.Item3,
+ }).ToList(),
+ };
+ }
+
+ public void Update(SchoolScheduleDataBase context, StudentBindingModel model)
+ {
+ FullName = model.FullName;
+ GradeId = model.GradeId;
+ Grade = context.Grades.First(y => y.Id == model.GradeId);
+ }
+
+ public StudentViewModel GetViewModel => new()
+ {
+ Id = Id,
+ FullName = FullName,
+ GradeId = GradeId,
+ GradeName = Grade.Year.ToString() + Grade.Letter.ToString(),
+ };
+
+ public void UpdateAttendance(SchoolScheduleDataBase context, StudentBindingModel model)
+ {
+ var attendance = context.LessonStudents.Where(rec => rec.StudentId == model.Id).ToList();
+ if (attendance != null && attendance.Count > 0)
+ {
+ context.LessonStudents.RemoveRange(attendance.Where(rec
+ => !model.Attendance.ContainsKey(rec.Id)));
+ context.SaveChanges();
+ }
+ var student = context.Students.First(x => x.Id == Id);
+ foreach (var pc in model.Attendance)
+ {
+ context.LessonStudents.Add(new LessonStudent
+ {
+ Student = student,
+ Lesson = context.Lessons.First(x => x.Id == pc.Key),
+ Mark = pc.Value.Item3,
+ Status = pc.Value.Item2,
+ });
+ context.SaveChanges();
+ }
+ _attendance = null;
+
+ }
+ }
+}
diff --git a/SchoolSchedule/SchoolScheduleDataBaseImplement/Models/Subject.cs b/SchoolSchedule/SchoolScheduleDataBaseImplement/Models/Subject.cs
new file mode 100644
index 0000000..74de405
--- /dev/null
+++ b/SchoolSchedule/SchoolScheduleDataBaseImplement/Models/Subject.cs
@@ -0,0 +1,45 @@
+using SchoolScheduleContracts.BindingModels;
+using SchoolScheduleContracts.ViewModels;
+using SchoolScheduleDataModels.Models;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using System.Diagnostics.Metrics;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SchoolScheduleDataBaseImplement.Models
+{
+ public class Subject : ISubjectModel
+ {
+ public int Id { get; private set; }
+ [Required]
+ public string SubjectName { get; private set; } = string.Empty;
+ [ForeignKey("SubjectId")]
+ public virtual List Lessons { get; set; } = new();
+
+ public static Subject? Create(SchoolScheduleDataBase context, SubjectBindingModel model)
+ {
+ if (model == null)
+ {
+ return null;
+ }
+ return new Subject()
+ {
+ Id = model.Id,
+ SubjectName = model.SubjectName,
+ };
+ }
+ public void Update(SchoolScheduleDataBase context, SubjectBindingModel model)
+ {
+ SubjectName = SubjectName;
+ }
+ public SubjectViewModel GetViewModel => new()
+ {
+ Id = Id,
+ SubjectName = SubjectName
+ };
+ }
+}
diff --git a/SchoolSchedule/SchoolScheduleDataBaseImplement/Models/Teacher.cs b/SchoolSchedule/SchoolScheduleDataBaseImplement/Models/Teacher.cs
new file mode 100644
index 0000000..d05dbbd
--- /dev/null
+++ b/SchoolSchedule/SchoolScheduleDataBaseImplement/Models/Teacher.cs
@@ -0,0 +1,45 @@
+using SchoolScheduleContracts.BindingModels;
+using SchoolScheduleContracts.ViewModels;
+using SchoolScheduleDataModels.Models;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using System.Diagnostics;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SchoolScheduleDataBaseImplement.Models
+{
+ public class Teacher : ITeacherModel
+ {
+ public int Id { get; private set; }
+ [Required]
+ public string FullName { get; private set; } = string.Empty;
+ [ForeignKey("TeacherId")]
+ public virtual List Lessons { get; set; } = new();
+ [ForeignKey("TeacherId")]
+ public virtual Grade Grade { get; set; }
+
+ public static Teacher Create(SchoolScheduleDataBase context, TeacherBindingModel model)
+ {
+ return new Teacher()
+ {
+ Id = model.Id,
+ FullName = model.FullName
+ };
+ }
+
+ public void Update(SchoolScheduleDataBase context, TeacherBindingModel model)
+ {
+ FullName = model.FullName;
+ }
+
+ public TeacherViewModel GetViewModel => new()
+ {
+ Id = Id,
+ FullName = FullName,
+ };
+ }
+}
diff --git a/SchoolSchedule/SchoolScheduleDataBaseImplement/SchoolScheduleDataBase.cs b/SchoolSchedule/SchoolScheduleDataBaseImplement/SchoolScheduleDataBase.cs
new file mode 100644
index 0000000..a270345
--- /dev/null
+++ b/SchoolSchedule/SchoolScheduleDataBaseImplement/SchoolScheduleDataBase.cs
@@ -0,0 +1,31 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Microsoft.EntityFrameworkCore;
+using SchoolScheduleDataBaseImplement.Models;
+
+namespace SchoolScheduleDataBaseImplement
+{
+ public class SchoolScheduleDataBase : DbContext
+ {
+ protected override void OnConfiguring(DbContextOptionsBuilder
+ optionsBuilder)
+ {
+ if (optionsBuilder.IsConfigured == false)
+ {
+ optionsBuilder.UseSqlServer(@"Data Source=localhost\SQLEXPRESS;Initial Catalog=SchoolScheduleDataBase;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
+ }
+ base.OnConfiguring(optionsBuilder);
+ }
+ public virtual DbSet Grades { set; get; }
+ public virtual DbSet Lessons { set; get; }
+ public virtual DbSet LessonStudents { set; get; }
+ public virtual DbSet SchedulePlaces { set; get; }
+ public virtual DbSet Students { set; get; }
+ public virtual DbSet Subjects { set; get; }
+ public virtual DbSet Teachers { set; get; }
+ }
+}
diff --git a/SchoolSchedule/SchoolScheduleDataBaseImplement/SchoolScheduleDataBaseImplement.csproj b/SchoolSchedule/SchoolScheduleDataBaseImplement/SchoolScheduleDataBaseImplement.csproj
new file mode 100644
index 0000000..a40fa83
--- /dev/null
+++ b/SchoolSchedule/SchoolScheduleDataBaseImplement/SchoolScheduleDataBaseImplement.csproj
@@ -0,0 +1,22 @@
+
+
+
+ net8.0
+ enable
+ enable
+
+
+
+
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
+
+
+
+
+
+
diff --git a/SchoolSchedule/SchoolScheduleDataModels/Enums/StudentStatus.cs b/SchoolSchedule/SchoolScheduleDataModels/Enums/StudentStatus.cs
new file mode 100644
index 0000000..80be139
--- /dev/null
+++ b/SchoolSchedule/SchoolScheduleDataModels/Enums/StudentStatus.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SchoolScheduleDataModels.Enums
+{
+ public enum StudentStatus
+ {
+ УП = 1,
+ ОТ = 2,
+ ПР = 3,
+ }
+}
diff --git a/SchoolSchedule/SchoolScheduleDataModels/IId.cs b/SchoolSchedule/SchoolScheduleDataModels/IId.cs
new file mode 100644
index 0000000..1903c29
--- /dev/null
+++ b/SchoolSchedule/SchoolScheduleDataModels/IId.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SchoolScheduleDataModels
+{
+ public interface IId
+ {
+ int Id { get; }
+ }
+}
diff --git a/SchoolSchedule/SchoolScheduleDataModels/Models/IGradeModel.cs b/SchoolSchedule/SchoolScheduleDataModels/Models/IGradeModel.cs
new file mode 100644
index 0000000..437e30c
--- /dev/null
+++ b/SchoolSchedule/SchoolScheduleDataModels/Models/IGradeModel.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SchoolScheduleDataModels.Models
+{
+ public interface IGradeModel : IId
+ {
+ int Year { get; }
+ char Letter { get; }
+ int TeacherId { get; }
+ }
+}
diff --git a/SchoolSchedule/SchoolScheduleDataModels/Models/ILessonModel.cs b/SchoolSchedule/SchoolScheduleDataModels/Models/ILessonModel.cs
new file mode 100644
index 0000000..2f1745f
--- /dev/null
+++ b/SchoolSchedule/SchoolScheduleDataModels/Models/ILessonModel.cs
@@ -0,0 +1,18 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SchoolScheduleDataModels.Models
+{
+ public interface ILessonModel : IId
+ {
+ DateOnly Date { get; }
+ string? Homework { get; }
+ int SchedulePlaceId { get; }
+ int TeacherId { get; }
+ int SubjectId { get; }
+ int GradeId { get; }
+ }
+}
diff --git a/SchoolSchedule/SchoolScheduleDataModels/Models/ISchedulePlaceModel.cs b/SchoolSchedule/SchoolScheduleDataModels/Models/ISchedulePlaceModel.cs
new file mode 100644
index 0000000..1a4cd8e
--- /dev/null
+++ b/SchoolSchedule/SchoolScheduleDataModels/Models/ISchedulePlaceModel.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SchoolScheduleDataModels.Models
+{
+ public interface ISchedulePlaceModel : IId
+ {
+ TimeOnly Time { get; }
+ }
+}
diff --git a/SchoolSchedule/SchoolScheduleDataModels/Models/IStudentModel.cs b/SchoolSchedule/SchoolScheduleDataModels/Models/IStudentModel.cs
new file mode 100644
index 0000000..c05e872
--- /dev/null
+++ b/SchoolSchedule/SchoolScheduleDataModels/Models/IStudentModel.cs
@@ -0,0 +1,16 @@
+using SchoolScheduleDataModels.Enums;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SchoolScheduleDataModels.Models
+{
+ public interface IStudentModel : IId
+ {
+ string FullName { get; }
+ int GradeId { get; }
+ Dictionary Attendance { get; }
+ }
+}
diff --git a/SchoolSchedule/SchoolScheduleDataModels/Models/ISubjectModel.cs b/SchoolSchedule/SchoolScheduleDataModels/Models/ISubjectModel.cs
new file mode 100644
index 0000000..9f669a5
--- /dev/null
+++ b/SchoolSchedule/SchoolScheduleDataModels/Models/ISubjectModel.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SchoolScheduleDataModels.Models
+{
+ public interface ISubjectModel : IId
+ {
+ string SubjectName { get; }
+ }
+}
diff --git a/SchoolSchedule/SchoolScheduleDataModels/Models/ITeacherModel.cs b/SchoolSchedule/SchoolScheduleDataModels/Models/ITeacherModel.cs
new file mode 100644
index 0000000..b45bd15
--- /dev/null
+++ b/SchoolSchedule/SchoolScheduleDataModels/Models/ITeacherModel.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SchoolScheduleDataModels.Models
+{
+ public interface ITeacherModel : IId
+ {
+ string FullName { get; }
+ }
+}
diff --git a/SchoolSchedule/SchoolScheduleDataModels/SchoolScheduleDataModels.csproj b/SchoolSchedule/SchoolScheduleDataModels/SchoolScheduleDataModels.csproj
new file mode 100644
index 0000000..30402ac
--- /dev/null
+++ b/SchoolSchedule/SchoolScheduleDataModels/SchoolScheduleDataModels.csproj
@@ -0,0 +1,9 @@
+
+
+
+ net8.0
+ enable
+ enable
+
+
+