diff --git a/SchoolAgainStudy/SchoolAgainStudy/SchoolAgainStudy.csproj b/SchoolAgainStudy/SchoolAgainStudy/SchoolAgainStudy.csproj index b57c89e..faaa0d6 100644 --- a/SchoolAgainStudy/SchoolAgainStudy/SchoolAgainStudy.csproj +++ b/SchoolAgainStudy/SchoolAgainStudy/SchoolAgainStudy.csproj @@ -8,4 +8,15 @@ enable + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + \ No newline at end of file diff --git a/SchoolAgainStudy/SchoolAgainStudyDataBaseImplements/Implements/DiyStorage.cs b/SchoolAgainStudy/SchoolAgainStudyDataBaseImplements/Implements/DiyStorage.cs new file mode 100644 index 0000000..4514054 --- /dev/null +++ b/SchoolAgainStudy/SchoolAgainStudyDataBaseImplements/Implements/DiyStorage.cs @@ -0,0 +1,125 @@ +using Microsoft.EntityFrameworkCore; +using SchoolAgainStudyContracts.BindingModel; +using SchoolAgainStudyContracts.SearchModel; +using SchoolAgainStudyContracts.StorageContracts; +using SchoolAgainStudyContracts.ViewModel; +using SchoolAgainStudyDataBaseImplements.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SchoolAgainStudyDataBaseImplements.Implements +{ + public class DiyStorage : IDiyStorage + { + public List GetFullList() + { + using var context = new SchoolDataBase(); + return context.Diys + .Include(x => x.Interests) + .ThenInclude(x => x.Interest) + .ToList() + .Select(x => x.GetViewModel) + .ToList(); + } + + public List GetFilteredList(DiySearchModel model) + { + + if(!model.StudentId.HasValue) + { + return new(); + } + using var context = new SchoolDataBase(); + if(model.DateFrom.HasValue && model.DateTo.HasValue && model.StudentId.HasValue) + { + return context.Diys + .Include(x => x.Interests) + .ThenInclude(x => x.Interest) + .Where(x => x.DateCreate >= model.DateFrom && x.DateCreate <= model.DateTo && x.StudentId == model.StudentId) + .ToList() + .Select(x => x.GetViewModel) + .ToList(); + } + + return context.Diys + .Include(x => x.Interests) + .ThenInclude(x => x.Interest) + .Where(x => x.StudentId == model.StudentId ) + .ToList() + .Select(x => x.GetViewModel) + .ToList(); + + + } + + public DiyViewModel? GetElement(DiySearchModel model) + { + if (string.IsNullOrEmpty(model.Title) && !model.Id.HasValue) + { + return null; + } + using var context = new SchoolDataBase(); + return context.Diys + .Include(x => x.Interests) + .ThenInclude(x => x.Interest) + .FirstOrDefault(x => (!string.IsNullOrEmpty(model.Title) && x.Title == model.Title) || + (model.Id.HasValue && x.Id == model.Id)) + ?.GetViewModel; + } + + public DiyViewModel? Insert(DiyBindingModel model) + { + using var context = new SchoolDataBase(); + var newDiy = Diy.Create(context, model); + if (newDiy == null) + { + return null; + } + context.Diys.Add(newDiy); + context.SaveChanges(); + return newDiy.GetViewModel; + } + + public DiyViewModel? Update(DiyBindingModel model) + { + using var context = new SchoolDataBase(); + using var transaction = context.Database.BeginTransaction(); + try + { + var diy = context.Diys.FirstOrDefault(rec => rec.Id == model.Id); + if (diy == null) + { + return null; + } + diy.Update(model); + context.SaveChanges(); + diy.UpdateInterests(context, model); + transaction.Commit(); + return diy.GetViewModel; + } + catch + { + transaction.Rollback(); + throw; + } + } + + public DiyViewModel? Delete(DiyBindingModel model) + { + using var context = new SchoolDataBase(); + var element = context.Diys + .Include(x => x.Interests) + .FirstOrDefault(rec => rec.Id == model.Id); + if (element != null) + { + context.Diys.Remove(element); + context.SaveChanges(); + return element.GetViewModel; + } + return null; + } + } +} diff --git a/SchoolAgainStudy/SchoolAgainStudyDataBaseImplements/Implements/InterestStorage.cs b/SchoolAgainStudy/SchoolAgainStudyDataBaseImplements/Implements/InterestStorage.cs new file mode 100644 index 0000000..a801569 --- /dev/null +++ b/SchoolAgainStudy/SchoolAgainStudyDataBaseImplements/Implements/InterestStorage.cs @@ -0,0 +1,90 @@ +using SchoolAgainStudyContracts.BindingModel; +using SchoolAgainStudyContracts.SearchModel; +using SchoolAgainStudyContracts.StorageContracts; +using SchoolAgainStudyContracts.ViewModel; +using SchoolAgainStudyDataBaseImplements.Models; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SchoolAgainStudyDataBaseImplements.Implements +{ + public class InterestStorage : IInterestStorage + { + public List GetFullList() + { + using var context = new SchoolDataBase(); + return context.Interests + .Select(x => x.GetViewModel) + .ToList(); + } + + public List GetFilteredList(InterestSearchModel model) + { + if (!model.StudentId.HasValue) + { + return new(); + } + using var context = new SchoolDataBase(); + return context.Interests + .Where(x => x.StudentId == model.StudentId) + .Select(x => x.GetViewModel) + .ToList(); + } + + public InterestViewModel? GetElement(InterestSearchModel model) + { + if (string.IsNullOrEmpty(model.Title) && !model.Id.HasValue) + { + return null; + } + using var context = new SchoolDataBase(); + return context.Interests + .FirstOrDefault(x => (!string.IsNullOrEmpty(model.Title) && x.Title == model.Title) || + (model.Id.HasValue && x.Id == model.Id)) + ?.GetViewModel; + } + + public InterestViewModel? Insert(InterestBindingModel model) + { + var newInterest = Interest.Create(model); + if (newInterest == null) + { + return null; + } + using var context = new SchoolDataBase(); + context.Interests.Add(newInterest); + context.SaveChanges(); + return newInterest.GetViewModel; + } + + public InterestViewModel? Update(InterestBindingModel model) + { + using var context = new SchoolDataBase(); + var interest = context.Interests.FirstOrDefault(x => x.Id == model.Id); + if (interest == null) + { + return null; + } + interest.Update(model); + context.SaveChanges(); + return interest.GetViewModel; + } + + public InterestViewModel? Delete(InterestBindingModel model) + { + using var context = new SchoolDataBase(); + var element = context.Interests.FirstOrDefault(rec => rec.Id == model.Id); + if (element != null ) + { + context.Interests.Remove(element); + context.SaveChanges(); + return element.GetViewModel; + } + return null; + } + } +} diff --git a/SchoolAgainStudy/SchoolAgainStudyDataBaseImplements/Implements/LessonStorage.cs b/SchoolAgainStudy/SchoolAgainStudyDataBaseImplements/Implements/LessonStorage.cs new file mode 100644 index 0000000..ff3d6fd --- /dev/null +++ b/SchoolAgainStudy/SchoolAgainStudyDataBaseImplements/Implements/LessonStorage.cs @@ -0,0 +1,121 @@ +using Microsoft.EntityFrameworkCore; +using SchoolAgainStudyContracts.BindingModel; +using SchoolAgainStudyContracts.SearchModel; +using SchoolAgainStudyContracts.StorageContracts; +using SchoolAgainStudyContracts.ViewModel; +using SchoolAgainStudyDataBaseImplements.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SchoolAgainStudyDataBaseImplements.Implements +{ + public class LessonStorage : ILessonStorage + { + public List GetFullList() + { + using var context = new SchoolDataBase(); + return context.Lessons + .Include(x => x.Materials) + .ThenInclude(x => x.Material) + .ToList() + .Select(x => x.GetViewModel) + .ToList(); + } + + public List GetFilteredList(LessonSearchModel model) + { + if (!model.TeacherId.HasValue) + { + return new(); + } + using var context = new SchoolDataBase(); + if (model.TeacherId.HasValue && model.DateFrom.HasValue && model.DateTo.HasValue) + { + return context.Lessons + .Include(x => x.Materials) + .ThenInclude(x => x.Material) + .Where(x => x.DateEvent >= model.DateFrom && x.DateEvent <= model.DateTo && x.TeacherId == model.TeacherId) + .ToList() + .Select(x => x.GetViewModel) + .ToList(); + } + return context.Lessons + .Include(x => x.Materials) + .ThenInclude(x => x.Material) + .Where(x => x.TeacherId == model.TeacherId) + .ToList() + .Select(x => x.GetViewModel) + .ToList(); + } + + public LessonViewModel? GetElement(LessonSearchModel model) + { + if (string.IsNullOrEmpty(model.Title) && !model.Id.HasValue) + { + return null; + } + using var context = new SchoolDataBase(); + return context.Lessons + .Include(x => x.Materials) + .ThenInclude(x => x.Material) + .FirstOrDefault(x => (!string.IsNullOrEmpty(model.Title) && x.Title == model.Title) || + (model.Id.HasValue && x.Id == model.Id)) + ?.GetViewModel; + } + + public LessonViewModel? Insert(LessonBindingModel model) + { + using var context = new SchoolDataBase(); + var newLesson = Lesson.Create(context, model); + if (newLesson == null) + { + return null; + } + context.Lessons.Add(newLesson); + context.SaveChanges(); + return newLesson.GetViewModel; + } + + public LessonViewModel? Update(LessonBindingModel model) + { + using var context = new SchoolDataBase(); + using var transaction = context.Database.BeginTransaction(); + try + { + var lesson = context.Lessons.FirstOrDefault(rec => rec.Id == model.Id); + if (lesson == null) + { + return null; + } + lesson.Update(model); + context.SaveChanges(); + lesson.UpdateMaterials(context, model); + transaction.Commit(); + return lesson.GetViewModel; + } + catch + { + transaction.Rollback(); + throw; + } + } + + public LessonViewModel? Delete(LessonBindingModel model) + { + using var context = new SchoolDataBase(); + var element = context.Lessons + .Include(x => x.Materials) + .FirstOrDefault(rec => rec.Id == model.Id); + if (element != null) + { + context.Lessons.Remove(element); + context.SaveChanges(); + return element.GetViewModel; + } + return null; + } + } +} diff --git a/SchoolAgainStudy/SchoolAgainStudyDataBaseImplements/Implements/MaterialStorage.cs b/SchoolAgainStudy/SchoolAgainStudyDataBaseImplements/Implements/MaterialStorage.cs new file mode 100644 index 0000000..8c09b9e --- /dev/null +++ b/SchoolAgainStudy/SchoolAgainStudyDataBaseImplements/Implements/MaterialStorage.cs @@ -0,0 +1,89 @@ +using SchoolAgainStudyContracts.BindingModel; +using SchoolAgainStudyContracts.SearchModel; +using SchoolAgainStudyContracts.StorageContracts; +using SchoolAgainStudyContracts.ViewModel; +using SchoolAgainStudyDataBaseImplements.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SchoolAgainStudyDataBaseImplements.Implements +{ + public class MaterialStorage : IMaterialStorage + { + public List GetFullList() + { + using var context = new SchoolDataBase(); + return context.Materials + .Select(x => x.GetViewModel) + .ToList(); + } + + public List GetFilteredList(MaterialSearchModel model) + { + if (!model.TeacherId.HasValue) + { + return new(); + } + using var context = new SchoolDataBase(); + return context.Materials + .Where(x => x.TeacherId == model.TeacherId) + .Select(x => x.GetViewModel) + .ToList(); + } + + public MaterialViewModel? GetElement(MaterialSearchModel model) + { + if (string.IsNullOrEmpty(model.Title) && !model.Id.HasValue) + { + return null; + } + using var context = new SchoolDataBase(); + return context.Materials + .FirstOrDefault(x => (!string.IsNullOrEmpty(model.Title) && x.Title == model.Title) || + (model.Id.HasValue && x.Id == model.Id)) + ?.GetViewModel; + } + + public MaterialViewModel? Insert(MaterialBindingModel model) + { + var newMaterial = Material.Create(model); + if (newMaterial == null) + { + return null; + } + using var context = new SchoolDataBase(); + context.Materials.Add(newMaterial); + context.SaveChanges(); + return newMaterial.GetViewModel; + } + + public MaterialViewModel? Update(MaterialBindingModel model) + { + using var context = new SchoolDataBase(); + var material = context.Materials.FirstOrDefault(x => x.Id == model.Id); + if (material == null ) + { + return null; + } + material.Update(model); + context.SaveChanges(); + return material.GetViewModel; + } + + public MaterialViewModel? Delete(MaterialBindingModel model) + { + using var context = new SchoolDataBase(); + var element = context.Materials.FirstOrDefault(rec => rec.Id == model.Id); + if (element != null ) + { + context.Materials.Remove(element); + context.SaveChanges(); + return element.GetViewModel; + } + return null; + } + } +} diff --git a/SchoolAgainStudy/SchoolAgainStudyDataBaseImplements/Implements/ProductStorage.cs b/SchoolAgainStudy/SchoolAgainStudyDataBaseImplements/Implements/ProductStorage.cs new file mode 100644 index 0000000..693c12a --- /dev/null +++ b/SchoolAgainStudy/SchoolAgainStudyDataBaseImplements/Implements/ProductStorage.cs @@ -0,0 +1,123 @@ +using Microsoft.EntityFrameworkCore; +using SchoolAgainStudyContracts.BindingModel; +using SchoolAgainStudyContracts.SearchModel; +using SchoolAgainStudyContracts.StorageContracts; +using SchoolAgainStudyContracts.ViewModel; +using SchoolAgainStudyDataBaseImplements.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.ConstrainedExecution; +using System.Text; +using System.Threading.Tasks; + +namespace SchoolAgainStudyDataBaseImplements.Implements +{ + public class ProductStorage : IProductStorage + { + public List GetFullList() + { + using var context = new SchoolDataBase(); + return context.Products + .Include(x => x.Interests) + .ThenInclude(x => x.Interest) + .ToList() + .Select(x => x.GetViewModel) + .ToList(); + } + + public List GetFilteredList(ProductSearchModel model) + { + if (!model.StudentId.HasValue) + { + return new(); + } + using var context = new SchoolDataBase(); + if (model.StudentId.HasValue && model.DateFrom.HasValue && model.DateTo.HasValue) + { + return context.Products + .Include(x => x.Interests) + .ThenInclude(x => x.Interest) + .Where(x => x.DateCreate >= model.DateFrom && x.DateCreate <= model.DateTo && x.StudentId == model.StudentId) + .ToList() + .Select(x => x.GetViewModel) + .ToList(); + } + return context.Products + .Include(x => x.Interests) + .ThenInclude(x => x.Interest) + .Where(x => x.StudentId == model.StudentId) + .ToList() + .Select(x => x.GetViewModel) + .ToList(); + + } + + public ProductViewModel? GetElement(ProductSearchModel model) + { + if (string.IsNullOrEmpty(model.Title) && !model.Id.HasValue) + { + return null; + } + using var context = new SchoolDataBase(); + return context.Products + .Include(x => x.Interests) + .ThenInclude(x => x.Interest) + .FirstOrDefault(x => (!string.IsNullOrEmpty(model.Title) && x.Title == model.Title) || + (model.Id.HasValue && x.Id == model.Id)) + ?.GetViewModel; + } + + public ProductViewModel? Insert(ProductBindingModel model) + { + using var context = new SchoolDataBase(); + var newProduct = Product.Create(context, model); + if (newProduct == null) + { + return null; + } + context.Products.Add(newProduct); + context.SaveChanges(); + return newProduct.GetViewModel; + } + + public ProductViewModel? Update(ProductBindingModel model) + { + using var context = new SchoolDataBase(); + using var transaction = context.Database.BeginTransaction(); + try + { + var product = context.Products.FirstOrDefault(rec => rec.Id == model.Id); + if (product == null) + { + return null; + } + product.Update(model); + context.SaveChanges(); + product.UpdateInterests(context, model); + transaction.Commit(); + return product.GetViewModel; + } + catch + { + transaction.Rollback(); + throw; + } + } + + public ProductViewModel? Delete(ProductBindingModel model) + { + using var context = new SchoolDataBase(); + var element = context.Products + .Include(x => x.Interests) + .FirstOrDefault(rec => rec.Id == model.Id); + if (element != null) + { + context.Products.Remove(element); + context.SaveChanges(); + return element.GetViewModel; + } + return null; + } + } +} diff --git a/SchoolAgainStudy/SchoolAgainStudyDataBaseImplements/Implements/StudentStorage.cs b/SchoolAgainStudy/SchoolAgainStudyDataBaseImplements/Implements/StudentStorage.cs new file mode 100644 index 0000000..b1b9e65 --- /dev/null +++ b/SchoolAgainStudy/SchoolAgainStudyDataBaseImplements/Implements/StudentStorage.cs @@ -0,0 +1,105 @@ +using Microsoft.EntityFrameworkCore; +using SchoolAgainStudyContracts.BindingModel; +using SchoolAgainStudyContracts.SearchModel; +using SchoolAgainStudyContracts.StorageContracts; +using SchoolAgainStudyContracts.ViewModel; +using SchoolAgainStudyDataBaseImplements.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.ConstrainedExecution; +using System.Text; +using System.Threading.Tasks; + +namespace SchoolAgainStudyDataBaseImplements.Implements +{ + public class StudentStorage : IStudentStorage + { + public StudentViewModel? Delete(StudentBindingModel model) + { + using var context = new SchoolDataBase(); + var element = context.Students + .FirstOrDefault(rec => rec.Id == model.Id); + if (element != null) + { + context.Students.Remove(element); + context.SaveChanges(); + return element.GetViewModel; + } + return null; + } + + public StudentViewModel? GetElement(StudentSearchModel model) + { + if (string.IsNullOrEmpty(model.Login) && !model.Id.HasValue) + { + return null; + } + using var context = new SchoolDataBase(); + return context.Students + .FirstOrDefault(x => (!string.IsNullOrEmpty(model.Login) && x.Login == model.Login) || + (model.Id.HasValue && x.Id == model.Id)) + ?.GetViewModel; + } + + public List GetFilteredList(StudentSearchModel model) + { + if (string.IsNullOrEmpty(model.Name)) + { + return new(); + } + using var context = new SchoolDataBase(); + return context.Students + .Where(x => x.Name.Contains(model.Name)) + .ToList() + .Select(x => x.GetViewModel) + .ToList(); + } + + public List GetFullList() + { + using var context = new SchoolDataBase(); + return context.Students + .ToList() + .Select(x => x.GetViewModel) + .ToList(); + } + + public StudentViewModel? Insert(StudentBindingModel model) + { + using var context = new SchoolDataBase(); + var newStudent = Student.Create(context, model); + if (newStudent == null) + { + return null; + } + context.Students.Add(newStudent); + context.SaveChanges(); + return newStudent.GetViewModel; + } + + public StudentViewModel? Update(StudentBindingModel model) + { + using var context = new SchoolDataBase(); + using var transaction = context.Database.BeginTransaction(); + try + { + var student = context.Students.FirstOrDefault(rec => rec.Id == model.Id); + if (student == null) + { + return null; + } + student.Update(model); + context.SaveChanges(); + transaction.Commit(); + return student.GetViewModel; + } + catch + { + transaction.Rollback(); + throw; + } + } + } +} + diff --git a/SchoolAgainStudy/SchoolAgainStudyDataBaseImplements/Implements/TaskStorage.cs b/SchoolAgainStudy/SchoolAgainStudyDataBaseImplements/Implements/TaskStorage.cs new file mode 100644 index 0000000..52d9f4d --- /dev/null +++ b/SchoolAgainStudy/SchoolAgainStudyDataBaseImplements/Implements/TaskStorage.cs @@ -0,0 +1,122 @@ +using Microsoft.EntityFrameworkCore; +using SchoolAgainStudyContracts.BindingModel; +using SchoolAgainStudyContracts.SearchModel; +using SchoolAgainStudyContracts.StorageContracts; +using SchoolAgainStudyContracts.ViewModel; +using SchoolAgainStudyDataBaseImplements.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Task = SchoolAgainStudyDataBaseImplements.Models.Task; + +namespace SchoolAgainStudyDataBaseImplements.Implements +{ + public class TaskStorage : ITaskStorage + { + public List GetFullList() + { + using var context = new SchoolDataBase(); + return context.Tasks + .Include(x => x.Materials) + .ThenInclude(x => x.Material) + .ToList() + .Select(x => x.GetViewModel) + .ToList(); + } + + public List GetFilteredList(TaskSearchModel model) + { + if (!model.TeacherId.HasValue) + { + return new(); + } + using var context = new SchoolDataBase(); + if (model.TeacherId.HasValue && model.DateFrom.HasValue && model.DateTo.HasValue) + { + return context.Tasks + .Include(x => x.Materials) + .ThenInclude(x => x.Material) + .Where(x => x.DateIssue >= model.DateFrom && x.DateIssue <= model.DateTo && x.TeacherId == model.TeacherId) + .ToList() + .Select(x => x.GetViewModel) + .ToList(); + } + return context.Tasks + .Include(x => x.Materials) + .ThenInclude(x => x.Material) + .Where(x => x.TeacherId == model.TeacherId) + .ToList() + .Select(x => x.GetViewModel) + .ToList(); + } + + public TaskViewModel? GetElement(TaskSearchModel model) + { + if (string.IsNullOrEmpty(model.Title) && !model.Id.HasValue) + { + return null; + } + using var context = new SchoolDataBase(); + return context.Tasks + .Include(x => x.Materials) + .ThenInclude(x => x.Material) + .FirstOrDefault(x => (!string.IsNullOrEmpty(model.Title) && x.Title == model.Title) || + (model.Id.HasValue && x.Id == model.Id)) + ?.GetViewModel; + } + + public TaskViewModel? Insert(TaskBindingModel model) + { + using var context = new SchoolDataBase(); + var newTask = Task.Create(context, model); + if (newTask == null) + { + return null; + } + context.Tasks.Add(newTask); + context.SaveChanges(); + return newTask.GetViewModel; + } + + public TaskViewModel? Update(TaskBindingModel model) + { + using var context = new SchoolDataBase(); + using var transaction = context.Database.BeginTransaction(); + try + { + var task = context.Tasks.FirstOrDefault(rec => rec.Id == model.Id); + if (task == null) + { + return null; + } + task.Update(model); + context.SaveChanges(); + task.UpdateMaterials(context, model); + transaction.Commit(); + return task.GetViewModel; + } + catch + { + transaction.Rollback(); + throw; + } + } + + public TaskViewModel? Delete(TaskBindingModel model) + { + using var context = new SchoolDataBase(); + var element = context.Tasks + .Include(x => x.Materials) + .FirstOrDefault(rec => rec.Id == model.Id); + if (element != null) + { + context.Tasks.Remove(element); + context.SaveChanges(); + return element.GetViewModel; + } + return null; + } + } +} diff --git a/SchoolAgainStudy/SchoolAgainStudyDataBaseImplements/Implements/TeacherStorage.cs b/SchoolAgainStudy/SchoolAgainStudyDataBaseImplements/Implements/TeacherStorage.cs new file mode 100644 index 0000000..85c9ec2 --- /dev/null +++ b/SchoolAgainStudy/SchoolAgainStudyDataBaseImplements/Implements/TeacherStorage.cs @@ -0,0 +1,103 @@ +using Microsoft.EntityFrameworkCore; +using SchoolAgainStudyContracts.BindingModel; +using SchoolAgainStudyContracts.SearchModel; +using SchoolAgainStudyContracts.StorageContracts; +using SchoolAgainStudyContracts.ViewModel; +using SchoolAgainStudyDataBaseImplements.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SchoolAgainStudyDataBaseImplements.Implements +{ + public class TeacherStorage : ITeacherStorage + { + public TeacherViewModel? Delete(TeacherBindingModel model) + { + using var context = new SchoolDataBase(); + var element = context.Teachers + .FirstOrDefault(rec => rec.Id == model.Id); + if (element != null) + { + context.Teachers.Remove(element); + context.SaveChanges(); + return element.GetViewModel; + } + return null; + } + + public TeacherViewModel? GetElement(TeacherSearchModel model) + { + if (string.IsNullOrEmpty(model.Login) && !model.Id.HasValue) + { + return null; + } + using var context = new SchoolDataBase(); + return context.Teachers + .FirstOrDefault(x => (!string.IsNullOrEmpty(model.Login) && x.Login == model.Login) || + (model.Id.HasValue && x.Id == model.Id)) + ?.GetViewModel; + } + + public List GetFilteredList(TeacherSearchModel model) + { + if (string.IsNullOrEmpty(model.Name)) + { + return new(); + } + using var context = new SchoolDataBase(); + return context.Teachers + .Where(x => x.Name.Contains(model.Name)) + .ToList() + .Select(x => x.GetViewModel) + .ToList(); + } + + public List GetFullList() + { + using var context = new SchoolDataBase(); + return context.Teachers + .ToList() + .Select(x => x.GetViewModel) + .ToList(); + } + + public TeacherViewModel? Insert(TeacherBindingModel model) + { + using var context = new SchoolDataBase(); + var newTeacher = Teacher.Create(context, model); + if (newTeacher == null) + { + return null; + } + context.Teachers.Add(newTeacher); + context.SaveChanges(); + return newTeacher.GetViewModel; + } + + public TeacherViewModel? Update(TeacherBindingModel model) + { + using var context = new SchoolDataBase(); + using var transaction = context.Database.BeginTransaction(); + try + { + var teacher = context.Teachers.FirstOrDefault(rec => rec.Id == model.Id); + if (teacher == null) + { + return null; + } + teacher.Update(model); + context.SaveChanges(); + transaction.Commit(); + return teacher.GetViewModel; + } + catch + { + transaction.Rollback(); + throw; + } + } + } +} diff --git a/SchoolAgainStudy/SchoolAgainStudyDataBaseImplements/Migrations/20230405182217_Initial.Designer.cs b/SchoolAgainStudy/SchoolAgainStudyDataBaseImplements/Migrations/20230405182217_Initial.Designer.cs new file mode 100644 index 0000000..15bb3c8 --- /dev/null +++ b/SchoolAgainStudy/SchoolAgainStudyDataBaseImplements/Migrations/20230405182217_Initial.Designer.cs @@ -0,0 +1,598 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; +using SchoolAgainStudyDataBaseImplements; + +#nullable disable + +namespace SchoolAgainStudyDataBaseImplements.Migrations +{ + [DbContext(typeof(SchoolDataBase))] + [Migration("20230405182217_Initial")] + partial class Initial + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.4") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.Diy", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("DateCreate") + .HasColumnType("timestamp with time zone"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("StudentId") + .HasColumnType("integer"); + + b.Property("StudentName") + .IsRequired() + .HasColumnType("text"); + + b.Property("TaskId") + .HasColumnType("integer"); + + b.Property("TaskName") + .IsRequired() + .HasColumnType("text"); + + b.Property("Title") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("StudentId"); + + b.HasIndex("TaskId"); + + b.ToTable("Diys"); + }); + + modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.DiyInterest", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("DiyId") + .HasColumnType("integer"); + + b.Property("InterestId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("DiyId"); + + b.HasIndex("InterestId"); + + b.ToTable("DiyInterests"); + }); + + modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.Interest", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("StudentId") + .HasColumnType("integer"); + + b.Property("Title") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("StudentId"); + + b.ToTable("Interests"); + }); + + modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.Lesson", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("DateEvent") + .HasColumnType("timestamp with time zone"); + + b.Property("ProductId") + .HasColumnType("integer"); + + b.Property("ProductName") + .IsRequired() + .HasColumnType("text"); + + b.Property("TeacherId") + .HasColumnType("integer"); + + b.Property("TeacherName") + .IsRequired() + .HasColumnType("text"); + + b.Property("Title") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("ProductId"); + + b.HasIndex("TeacherId"); + + b.ToTable("Lessons"); + }); + + modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.LessonMaterial", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("LessonId") + .HasColumnType("integer"); + + b.Property("MaterialId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("LessonId"); + + b.HasIndex("MaterialId"); + + b.ToTable("LessonMaterials"); + }); + + modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.Material", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("SphereUse") + .IsRequired() + .HasColumnType("text"); + + b.Property("TeacherId") + .HasColumnType("integer"); + + b.Property("Title") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("TeacherId"); + + b.ToTable("Materials"); + }); + + modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.Product", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("DateCreate") + .HasColumnType("timestamp with time zone"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("StudentId") + .HasColumnType("integer"); + + b.Property("StudentName") + .IsRequired() + .HasColumnType("text"); + + b.Property("Title") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("StudentId"); + + b.ToTable("Products"); + }); + + modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.ProductInterest", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("InterestId") + .HasColumnType("integer"); + + b.Property("ProductId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("InterestId"); + + b.HasIndex("ProductId"); + + b.ToTable("ProductInterests"); + }); + + modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.Student", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Class") + .HasColumnType("integer"); + + b.Property("Email") + .IsRequired() + .HasColumnType("text"); + + b.Property("Login") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("Password") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("Students"); + }); + + modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.Task", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("DateDelivery") + .HasColumnType("timestamp with time zone"); + + b.Property("DateIssue") + .HasColumnType("timestamp with time zone"); + + b.Property("TeacherId") + .HasColumnType("integer"); + + b.Property("TeacherName") + .IsRequired() + .HasColumnType("text"); + + b.Property("Title") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("TeacherId"); + + b.ToTable("Tasks"); + }); + + modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.TaskMaterial", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("MaterialId") + .HasColumnType("integer"); + + b.Property("TaskId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("MaterialId"); + + b.HasIndex("TaskId"); + + b.ToTable("TaskMaterials"); + }); + + modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.Teacher", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Login") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("Password") + .IsRequired() + .HasColumnType("text"); + + b.Property("Phone") + .IsRequired() + .HasColumnType("text"); + + b.Property("Post") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("Teachers"); + }); + + modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.Diy", b => + { + b.HasOne("SchoolAgainStudyDataBaseImplements.Models.Student", "Student") + .WithMany("Diys") + .HasForeignKey("StudentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SchoolAgainStudyDataBaseImplements.Models.Task", "Task") + .WithMany("Diys") + .HasForeignKey("TaskId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Student"); + + b.Navigation("Task"); + }); + + modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.DiyInterest", b => + { + b.HasOne("SchoolAgainStudyDataBaseImplements.Models.Diy", "Diy") + .WithMany("Interests") + .HasForeignKey("DiyId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SchoolAgainStudyDataBaseImplements.Models.Interest", "Interest") + .WithMany("DiyInterests") + .HasForeignKey("InterestId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Diy"); + + b.Navigation("Interest"); + }); + + modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.Interest", b => + { + b.HasOne("SchoolAgainStudyDataBaseImplements.Models.Student", "Student") + .WithMany("Interests") + .HasForeignKey("StudentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Student"); + }); + + modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.Lesson", b => + { + b.HasOne("SchoolAgainStudyDataBaseImplements.Models.Product", "Product") + .WithMany("Lessons") + .HasForeignKey("ProductId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SchoolAgainStudyDataBaseImplements.Models.Teacher", "Teacher") + .WithMany("Lessons") + .HasForeignKey("TeacherId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Product"); + + b.Navigation("Teacher"); + }); + + modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.LessonMaterial", b => + { + b.HasOne("SchoolAgainStudyDataBaseImplements.Models.Lesson", "Lesson") + .WithMany("Materials") + .HasForeignKey("LessonId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SchoolAgainStudyDataBaseImplements.Models.Material", "Material") + .WithMany("LessonMaterials") + .HasForeignKey("MaterialId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Lesson"); + + b.Navigation("Material"); + }); + + modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.Material", b => + { + b.HasOne("SchoolAgainStudyDataBaseImplements.Models.Teacher", "Teacher") + .WithMany("Materials") + .HasForeignKey("TeacherId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Teacher"); + }); + + modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.Product", b => + { + b.HasOne("SchoolAgainStudyDataBaseImplements.Models.Student", "Student") + .WithMany("Products") + .HasForeignKey("StudentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Student"); + }); + + modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.ProductInterest", b => + { + b.HasOne("SchoolAgainStudyDataBaseImplements.Models.Interest", "Interest") + .WithMany("ProductInterests") + .HasForeignKey("InterestId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SchoolAgainStudyDataBaseImplements.Models.Product", "Product") + .WithMany("Interests") + .HasForeignKey("ProductId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Interest"); + + b.Navigation("Product"); + }); + + modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.Task", b => + { + b.HasOne("SchoolAgainStudyDataBaseImplements.Models.Teacher", "Teacher") + .WithMany("Tasks") + .HasForeignKey("TeacherId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Teacher"); + }); + + modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.TaskMaterial", b => + { + b.HasOne("SchoolAgainStudyDataBaseImplements.Models.Material", "Material") + .WithMany("TaskMaterial") + .HasForeignKey("MaterialId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SchoolAgainStudyDataBaseImplements.Models.Task", "Task") + .WithMany("Materials") + .HasForeignKey("TaskId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Material"); + + b.Navigation("Task"); + }); + + modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.Diy", b => + { + b.Navigation("Interests"); + }); + + modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.Interest", b => + { + b.Navigation("DiyInterests"); + + b.Navigation("ProductInterests"); + }); + + modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.Lesson", b => + { + b.Navigation("Materials"); + }); + + modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.Material", b => + { + b.Navigation("LessonMaterials"); + + b.Navigation("TaskMaterial"); + }); + + modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.Product", b => + { + b.Navigation("Interests"); + + b.Navigation("Lessons"); + }); + + modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.Student", b => + { + b.Navigation("Diys"); + + b.Navigation("Interests"); + + b.Navigation("Products"); + }); + + modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.Task", b => + { + b.Navigation("Diys"); + + b.Navigation("Materials"); + }); + + modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.Teacher", b => + { + b.Navigation("Lessons"); + + b.Navigation("Materials"); + + b.Navigation("Tasks"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/SchoolAgainStudy/SchoolAgainStudyDataBaseImplements/Migrations/20230405182217_Initial.cs b/SchoolAgainStudy/SchoolAgainStudyDataBaseImplements/Migrations/20230405182217_Initial.cs new file mode 100644 index 0000000..ae34854 --- /dev/null +++ b/SchoolAgainStudy/SchoolAgainStudyDataBaseImplements/Migrations/20230405182217_Initial.cs @@ -0,0 +1,423 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace SchoolAgainStudyDataBaseImplements.Migrations +{ + /// + public partial class Initial : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "Students", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + Name = table.Column(type: "text", nullable: false), + Class = table.Column(type: "integer", nullable: false), + Email = table.Column(type: "text", nullable: false), + Login = table.Column(type: "text", nullable: false), + Password = table.Column(type: "text", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Students", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Teachers", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + Name = table.Column(type: "text", nullable: false), + Post = table.Column(type: "text", nullable: false), + Phone = table.Column(type: "text", nullable: false), + Login = table.Column(type: "text", nullable: false), + Password = table.Column(type: "text", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Teachers", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Interests", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + Title = table.Column(type: "text", nullable: false), + Description = table.Column(type: "text", nullable: false), + StudentId = table.Column(type: "integer", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Interests", x => x.Id); + table.ForeignKey( + name: "FK_Interests_Students_StudentId", + column: x => x.StudentId, + principalTable: "Students", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Products", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + Title = table.Column(type: "text", nullable: false), + Description = table.Column(type: "text", nullable: false), + DateCreate = table.Column(type: "timestamp with time zone", nullable: false), + StudentId = table.Column(type: "integer", nullable: false), + StudentName = table.Column(type: "text", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Products", x => x.Id); + table.ForeignKey( + name: "FK_Products_Students_StudentId", + column: x => x.StudentId, + principalTable: "Students", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Materials", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + Title = table.Column(type: "text", nullable: false), + SphereUse = table.Column(type: "text", nullable: false), + TeacherId = table.Column(type: "integer", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Materials", x => x.Id); + table.ForeignKey( + name: "FK_Materials_Teachers_TeacherId", + column: x => x.TeacherId, + principalTable: "Teachers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Tasks", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + Title = table.Column(type: "text", nullable: false), + DateIssue = table.Column(type: "timestamp with time zone", nullable: false), + DateDelivery = table.Column(type: "timestamp with time zone", nullable: false), + TeacherId = table.Column(type: "integer", nullable: false), + TeacherName = table.Column(type: "text", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Tasks", x => x.Id); + table.ForeignKey( + name: "FK_Tasks_Teachers_TeacherId", + column: x => x.TeacherId, + principalTable: "Teachers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Lessons", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + Title = table.Column(type: "text", nullable: false), + DateEvent = table.Column(type: "timestamp with time zone", nullable: false), + ProductId = table.Column(type: "integer", nullable: false), + ProductName = table.Column(type: "text", nullable: false), + TeacherId = table.Column(type: "integer", nullable: false), + TeacherName = table.Column(type: "text", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Lessons", x => x.Id); + table.ForeignKey( + name: "FK_Lessons_Products_ProductId", + column: x => x.ProductId, + principalTable: "Products", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_Lessons_Teachers_TeacherId", + column: x => x.TeacherId, + principalTable: "Teachers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ProductInterests", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + ProductId = table.Column(type: "integer", nullable: false), + InterestId = table.Column(type: "integer", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ProductInterests", x => x.Id); + table.ForeignKey( + name: "FK_ProductInterests_Interests_InterestId", + column: x => x.InterestId, + principalTable: "Interests", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ProductInterests_Products_ProductId", + column: x => x.ProductId, + principalTable: "Products", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Diys", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + Title = table.Column(type: "text", nullable: false), + Description = table.Column(type: "text", nullable: false), + DateCreate = table.Column(type: "timestamp with time zone", nullable: false), + TaskId = table.Column(type: "integer", nullable: false), + TaskName = table.Column(type: "text", nullable: false), + StudentId = table.Column(type: "integer", nullable: false), + StudentName = table.Column(type: "text", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Diys", x => x.Id); + table.ForeignKey( + name: "FK_Diys_Students_StudentId", + column: x => x.StudentId, + principalTable: "Students", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_Diys_Tasks_TaskId", + column: x => x.TaskId, + principalTable: "Tasks", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "TaskMaterials", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + TaskId = table.Column(type: "integer", nullable: false), + MaterialId = table.Column(type: "integer", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_TaskMaterials", x => x.Id); + table.ForeignKey( + name: "FK_TaskMaterials_Materials_MaterialId", + column: x => x.MaterialId, + principalTable: "Materials", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_TaskMaterials_Tasks_TaskId", + column: x => x.TaskId, + principalTable: "Tasks", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "LessonMaterials", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + LessonId = table.Column(type: "integer", nullable: false), + MaterialId = table.Column(type: "integer", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_LessonMaterials", x => x.Id); + table.ForeignKey( + name: "FK_LessonMaterials_Lessons_LessonId", + column: x => x.LessonId, + principalTable: "Lessons", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_LessonMaterials_Materials_MaterialId", + column: x => x.MaterialId, + principalTable: "Materials", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "DiyInterests", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + DiyId = table.Column(type: "integer", nullable: false), + InterestId = table.Column(type: "integer", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_DiyInterests", x => x.Id); + table.ForeignKey( + name: "FK_DiyInterests_Diys_DiyId", + column: x => x.DiyId, + principalTable: "Diys", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_DiyInterests_Interests_InterestId", + column: x => x.InterestId, + principalTable: "Interests", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_DiyInterests_DiyId", + table: "DiyInterests", + column: "DiyId"); + + migrationBuilder.CreateIndex( + name: "IX_DiyInterests_InterestId", + table: "DiyInterests", + column: "InterestId"); + + migrationBuilder.CreateIndex( + name: "IX_Diys_StudentId", + table: "Diys", + column: "StudentId"); + + migrationBuilder.CreateIndex( + name: "IX_Diys_TaskId", + table: "Diys", + column: "TaskId"); + + migrationBuilder.CreateIndex( + name: "IX_Interests_StudentId", + table: "Interests", + column: "StudentId"); + + migrationBuilder.CreateIndex( + name: "IX_LessonMaterials_LessonId", + table: "LessonMaterials", + column: "LessonId"); + + migrationBuilder.CreateIndex( + name: "IX_LessonMaterials_MaterialId", + table: "LessonMaterials", + column: "MaterialId"); + + migrationBuilder.CreateIndex( + name: "IX_Lessons_ProductId", + table: "Lessons", + column: "ProductId"); + + migrationBuilder.CreateIndex( + name: "IX_Lessons_TeacherId", + table: "Lessons", + column: "TeacherId"); + + migrationBuilder.CreateIndex( + name: "IX_Materials_TeacherId", + table: "Materials", + column: "TeacherId"); + + migrationBuilder.CreateIndex( + name: "IX_ProductInterests_InterestId", + table: "ProductInterests", + column: "InterestId"); + + migrationBuilder.CreateIndex( + name: "IX_ProductInterests_ProductId", + table: "ProductInterests", + column: "ProductId"); + + migrationBuilder.CreateIndex( + name: "IX_Products_StudentId", + table: "Products", + column: "StudentId"); + + migrationBuilder.CreateIndex( + name: "IX_TaskMaterials_MaterialId", + table: "TaskMaterials", + column: "MaterialId"); + + migrationBuilder.CreateIndex( + name: "IX_TaskMaterials_TaskId", + table: "TaskMaterials", + column: "TaskId"); + + migrationBuilder.CreateIndex( + name: "IX_Tasks_TeacherId", + table: "Tasks", + column: "TeacherId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "DiyInterests"); + + migrationBuilder.DropTable( + name: "LessonMaterials"); + + migrationBuilder.DropTable( + name: "ProductInterests"); + + migrationBuilder.DropTable( + name: "TaskMaterials"); + + migrationBuilder.DropTable( + name: "Diys"); + + migrationBuilder.DropTable( + name: "Lessons"); + + migrationBuilder.DropTable( + name: "Interests"); + + migrationBuilder.DropTable( + name: "Materials"); + + migrationBuilder.DropTable( + name: "Tasks"); + + migrationBuilder.DropTable( + name: "Products"); + + migrationBuilder.DropTable( + name: "Teachers"); + + migrationBuilder.DropTable( + name: "Students"); + } + } +} diff --git a/SchoolAgainStudy/SchoolAgainStudyDataBaseImplements/Migrations/SchoolDataBaseModelSnapshot.cs b/SchoolAgainStudy/SchoolAgainStudyDataBaseImplements/Migrations/SchoolDataBaseModelSnapshot.cs new file mode 100644 index 0000000..009c271 --- /dev/null +++ b/SchoolAgainStudy/SchoolAgainStudyDataBaseImplements/Migrations/SchoolDataBaseModelSnapshot.cs @@ -0,0 +1,595 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; +using SchoolAgainStudyDataBaseImplements; + +#nullable disable + +namespace SchoolAgainStudyDataBaseImplements.Migrations +{ + [DbContext(typeof(SchoolDataBase))] + partial class SchoolDataBaseModelSnapshot : ModelSnapshot + { + protected override void BuildModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.4") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.Diy", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("DateCreate") + .HasColumnType("timestamp with time zone"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("StudentId") + .HasColumnType("integer"); + + b.Property("StudentName") + .IsRequired() + .HasColumnType("text"); + + b.Property("TaskId") + .HasColumnType("integer"); + + b.Property("TaskName") + .IsRequired() + .HasColumnType("text"); + + b.Property("Title") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("StudentId"); + + b.HasIndex("TaskId"); + + b.ToTable("Diys"); + }); + + modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.DiyInterest", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("DiyId") + .HasColumnType("integer"); + + b.Property("InterestId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("DiyId"); + + b.HasIndex("InterestId"); + + b.ToTable("DiyInterests"); + }); + + modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.Interest", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("StudentId") + .HasColumnType("integer"); + + b.Property("Title") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("StudentId"); + + b.ToTable("Interests"); + }); + + modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.Lesson", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("DateEvent") + .HasColumnType("timestamp with time zone"); + + b.Property("ProductId") + .HasColumnType("integer"); + + b.Property("ProductName") + .IsRequired() + .HasColumnType("text"); + + b.Property("TeacherId") + .HasColumnType("integer"); + + b.Property("TeacherName") + .IsRequired() + .HasColumnType("text"); + + b.Property("Title") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("ProductId"); + + b.HasIndex("TeacherId"); + + b.ToTable("Lessons"); + }); + + modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.LessonMaterial", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("LessonId") + .HasColumnType("integer"); + + b.Property("MaterialId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("LessonId"); + + b.HasIndex("MaterialId"); + + b.ToTable("LessonMaterials"); + }); + + modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.Material", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("SphereUse") + .IsRequired() + .HasColumnType("text"); + + b.Property("TeacherId") + .HasColumnType("integer"); + + b.Property("Title") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("TeacherId"); + + b.ToTable("Materials"); + }); + + modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.Product", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("DateCreate") + .HasColumnType("timestamp with time zone"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("StudentId") + .HasColumnType("integer"); + + b.Property("StudentName") + .IsRequired() + .HasColumnType("text"); + + b.Property("Title") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("StudentId"); + + b.ToTable("Products"); + }); + + modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.ProductInterest", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("InterestId") + .HasColumnType("integer"); + + b.Property("ProductId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("InterestId"); + + b.HasIndex("ProductId"); + + b.ToTable("ProductInterests"); + }); + + modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.Student", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Class") + .HasColumnType("integer"); + + b.Property("Email") + .IsRequired() + .HasColumnType("text"); + + b.Property("Login") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("Password") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("Students"); + }); + + modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.Task", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("DateDelivery") + .HasColumnType("timestamp with time zone"); + + b.Property("DateIssue") + .HasColumnType("timestamp with time zone"); + + b.Property("TeacherId") + .HasColumnType("integer"); + + b.Property("TeacherName") + .IsRequired() + .HasColumnType("text"); + + b.Property("Title") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("TeacherId"); + + b.ToTable("Tasks"); + }); + + modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.TaskMaterial", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("MaterialId") + .HasColumnType("integer"); + + b.Property("TaskId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("MaterialId"); + + b.HasIndex("TaskId"); + + b.ToTable("TaskMaterials"); + }); + + modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.Teacher", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Login") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("Password") + .IsRequired() + .HasColumnType("text"); + + b.Property("Phone") + .IsRequired() + .HasColumnType("text"); + + b.Property("Post") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("Teachers"); + }); + + modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.Diy", b => + { + b.HasOne("SchoolAgainStudyDataBaseImplements.Models.Student", "Student") + .WithMany("Diys") + .HasForeignKey("StudentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SchoolAgainStudyDataBaseImplements.Models.Task", "Task") + .WithMany("Diys") + .HasForeignKey("TaskId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Student"); + + b.Navigation("Task"); + }); + + modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.DiyInterest", b => + { + b.HasOne("SchoolAgainStudyDataBaseImplements.Models.Diy", "Diy") + .WithMany("Interests") + .HasForeignKey("DiyId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SchoolAgainStudyDataBaseImplements.Models.Interest", "Interest") + .WithMany("DiyInterests") + .HasForeignKey("InterestId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Diy"); + + b.Navigation("Interest"); + }); + + modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.Interest", b => + { + b.HasOne("SchoolAgainStudyDataBaseImplements.Models.Student", "Student") + .WithMany("Interests") + .HasForeignKey("StudentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Student"); + }); + + modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.Lesson", b => + { + b.HasOne("SchoolAgainStudyDataBaseImplements.Models.Product", "Product") + .WithMany("Lessons") + .HasForeignKey("ProductId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SchoolAgainStudyDataBaseImplements.Models.Teacher", "Teacher") + .WithMany("Lessons") + .HasForeignKey("TeacherId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Product"); + + b.Navigation("Teacher"); + }); + + modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.LessonMaterial", b => + { + b.HasOne("SchoolAgainStudyDataBaseImplements.Models.Lesson", "Lesson") + .WithMany("Materials") + .HasForeignKey("LessonId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SchoolAgainStudyDataBaseImplements.Models.Material", "Material") + .WithMany("LessonMaterials") + .HasForeignKey("MaterialId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Lesson"); + + b.Navigation("Material"); + }); + + modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.Material", b => + { + b.HasOne("SchoolAgainStudyDataBaseImplements.Models.Teacher", "Teacher") + .WithMany("Materials") + .HasForeignKey("TeacherId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Teacher"); + }); + + modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.Product", b => + { + b.HasOne("SchoolAgainStudyDataBaseImplements.Models.Student", "Student") + .WithMany("Products") + .HasForeignKey("StudentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Student"); + }); + + modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.ProductInterest", b => + { + b.HasOne("SchoolAgainStudyDataBaseImplements.Models.Interest", "Interest") + .WithMany("ProductInterests") + .HasForeignKey("InterestId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SchoolAgainStudyDataBaseImplements.Models.Product", "Product") + .WithMany("Interests") + .HasForeignKey("ProductId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Interest"); + + b.Navigation("Product"); + }); + + modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.Task", b => + { + b.HasOne("SchoolAgainStudyDataBaseImplements.Models.Teacher", "Teacher") + .WithMany("Tasks") + .HasForeignKey("TeacherId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Teacher"); + }); + + modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.TaskMaterial", b => + { + b.HasOne("SchoolAgainStudyDataBaseImplements.Models.Material", "Material") + .WithMany("TaskMaterial") + .HasForeignKey("MaterialId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SchoolAgainStudyDataBaseImplements.Models.Task", "Task") + .WithMany("Materials") + .HasForeignKey("TaskId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Material"); + + b.Navigation("Task"); + }); + + modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.Diy", b => + { + b.Navigation("Interests"); + }); + + modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.Interest", b => + { + b.Navigation("DiyInterests"); + + b.Navigation("ProductInterests"); + }); + + modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.Lesson", b => + { + b.Navigation("Materials"); + }); + + modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.Material", b => + { + b.Navigation("LessonMaterials"); + + b.Navigation("TaskMaterial"); + }); + + modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.Product", b => + { + b.Navigation("Interests"); + + b.Navigation("Lessons"); + }); + + modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.Student", b => + { + b.Navigation("Diys"); + + b.Navigation("Interests"); + + b.Navigation("Products"); + }); + + modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.Task", b => + { + b.Navigation("Diys"); + + b.Navigation("Materials"); + }); + + modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.Teacher", b => + { + b.Navigation("Lessons"); + + b.Navigation("Materials"); + + b.Navigation("Tasks"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/SchoolAgainStudy/SchoolAgainStudyDataBaseImplements/SchoolAgainStudyDataBaseImplements.csproj b/SchoolAgainStudy/SchoolAgainStudyDataBaseImplements/SchoolAgainStudyDataBaseImplements.csproj index 6b028b0..0b606a6 100644 --- a/SchoolAgainStudy/SchoolAgainStudyDataBaseImplements/SchoolAgainStudyDataBaseImplements.csproj +++ b/SchoolAgainStudy/SchoolAgainStudyDataBaseImplements/SchoolAgainStudyDataBaseImplements.csproj @@ -19,4 +19,8 @@ + + + +