добавление классов хранилищ и создание миграции БД
This commit is contained in:
parent
fd5b88d26e
commit
60e99edc70
@ -8,4 +8,15 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.4">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\SchoolAgainStudyDataBaseImplements\SchoolAgainStudyDataBaseImplements.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
@ -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<DiyViewModel> 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<DiyViewModel> 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;
|
||||
}
|
||||
}
|
||||
}
|
@ -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<InterestViewModel> GetFullList()
|
||||
{
|
||||
using var context = new SchoolDataBase();
|
||||
return context.Interests
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public List<InterestViewModel> 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;
|
||||
}
|
||||
}
|
||||
}
|
@ -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<LessonViewModel> 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<LessonViewModel> 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;
|
||||
}
|
||||
}
|
||||
}
|
@ -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<MaterialViewModel> GetFullList()
|
||||
{
|
||||
using var context = new SchoolDataBase();
|
||||
return context.Materials
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public List<MaterialViewModel> 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;
|
||||
}
|
||||
}
|
||||
}
|
@ -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<ProductViewModel> 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<ProductViewModel> 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;
|
||||
}
|
||||
}
|
||||
}
|
@ -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<StudentViewModel> 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<StudentViewModel> 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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<TaskViewModel> 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<TaskViewModel> 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;
|
||||
}
|
||||
}
|
||||
}
|
@ -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<TeacherViewModel> 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<TeacherViewModel> 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
598
SchoolAgainStudy/SchoolAgainStudyDataBaseImplements/Migrations/20230405182217_Initial.Designer.cs
generated
Normal file
598
SchoolAgainStudy/SchoolAgainStudyDataBaseImplements/Migrations/20230405182217_Initial.Designer.cs
generated
Normal file
@ -0,0 +1,598 @@
|
||||
// <auto-generated />
|
||||
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
|
||||
{
|
||||
/// <inheritdoc />
|
||||
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<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("DateCreate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("StudentId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("StudentName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("TaskId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("TaskName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("StudentId");
|
||||
|
||||
b.HasIndex("TaskId");
|
||||
|
||||
b.ToTable("Diys");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.DiyInterest", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("DiyId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("InterestId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("DiyId");
|
||||
|
||||
b.HasIndex("InterestId");
|
||||
|
||||
b.ToTable("DiyInterests");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.Interest", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("StudentId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("StudentId");
|
||||
|
||||
b.ToTable("Interests");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.Lesson", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("DateEvent")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<int>("ProductId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("ProductName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("TeacherId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("TeacherName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ProductId");
|
||||
|
||||
b.HasIndex("TeacherId");
|
||||
|
||||
b.ToTable("Lessons");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.LessonMaterial", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("LessonId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("MaterialId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("LessonId");
|
||||
|
||||
b.HasIndex("MaterialId");
|
||||
|
||||
b.ToTable("LessonMaterials");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.Material", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("SphereUse")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("TeacherId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("TeacherId");
|
||||
|
||||
b.ToTable("Materials");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.Product", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("DateCreate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("StudentId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("StudentName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("StudentId");
|
||||
|
||||
b.ToTable("Products");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.ProductInterest", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("InterestId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("ProductId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("InterestId");
|
||||
|
||||
b.HasIndex("ProductId");
|
||||
|
||||
b.ToTable("ProductInterests");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.Student", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("Class")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Login")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Students");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.Task", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("DateDelivery")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<DateTime>("DateIssue")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<int>("TeacherId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("TeacherName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("TeacherId");
|
||||
|
||||
b.ToTable("Tasks");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.TaskMaterial", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("MaterialId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("TaskId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("MaterialId");
|
||||
|
||||
b.HasIndex("TaskId");
|
||||
|
||||
b.ToTable("TaskMaterials");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.Teacher", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Login")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Phone")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("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
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,423 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace SchoolAgainStudyDataBaseImplements.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Initial : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Students",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
Name = table.Column<string>(type: "text", nullable: false),
|
||||
Class = table.Column<int>(type: "integer", nullable: false),
|
||||
Email = table.Column<string>(type: "text", nullable: false),
|
||||
Login = table.Column<string>(type: "text", nullable: false),
|
||||
Password = table.Column<string>(type: "text", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Students", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Teachers",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
Name = table.Column<string>(type: "text", nullable: false),
|
||||
Post = table.Column<string>(type: "text", nullable: false),
|
||||
Phone = table.Column<string>(type: "text", nullable: false),
|
||||
Login = table.Column<string>(type: "text", nullable: false),
|
||||
Password = table.Column<string>(type: "text", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Teachers", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Interests",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
Title = table.Column<string>(type: "text", nullable: false),
|
||||
Description = table.Column<string>(type: "text", nullable: false),
|
||||
StudentId = table.Column<int>(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<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
Title = table.Column<string>(type: "text", nullable: false),
|
||||
Description = table.Column<string>(type: "text", nullable: false),
|
||||
DateCreate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
StudentId = table.Column<int>(type: "integer", nullable: false),
|
||||
StudentName = table.Column<string>(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<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
Title = table.Column<string>(type: "text", nullable: false),
|
||||
SphereUse = table.Column<string>(type: "text", nullable: false),
|
||||
TeacherId = table.Column<int>(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<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
Title = table.Column<string>(type: "text", nullable: false),
|
||||
DateIssue = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
DateDelivery = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
TeacherId = table.Column<int>(type: "integer", nullable: false),
|
||||
TeacherName = table.Column<string>(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<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
Title = table.Column<string>(type: "text", nullable: false),
|
||||
DateEvent = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
ProductId = table.Column<int>(type: "integer", nullable: false),
|
||||
ProductName = table.Column<string>(type: "text", nullable: false),
|
||||
TeacherId = table.Column<int>(type: "integer", nullable: false),
|
||||
TeacherName = table.Column<string>(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<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
ProductId = table.Column<int>(type: "integer", nullable: false),
|
||||
InterestId = table.Column<int>(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<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
Title = table.Column<string>(type: "text", nullable: false),
|
||||
Description = table.Column<string>(type: "text", nullable: false),
|
||||
DateCreate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
TaskId = table.Column<int>(type: "integer", nullable: false),
|
||||
TaskName = table.Column<string>(type: "text", nullable: false),
|
||||
StudentId = table.Column<int>(type: "integer", nullable: false),
|
||||
StudentName = table.Column<string>(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<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
TaskId = table.Column<int>(type: "integer", nullable: false),
|
||||
MaterialId = table.Column<int>(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<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
LessonId = table.Column<int>(type: "integer", nullable: false),
|
||||
MaterialId = table.Column<int>(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<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
DiyId = table.Column<int>(type: "integer", nullable: false),
|
||||
InterestId = table.Column<int>(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");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,595 @@
|
||||
// <auto-generated />
|
||||
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<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("DateCreate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("StudentId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("StudentName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("TaskId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("TaskName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("StudentId");
|
||||
|
||||
b.HasIndex("TaskId");
|
||||
|
||||
b.ToTable("Diys");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.DiyInterest", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("DiyId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("InterestId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("DiyId");
|
||||
|
||||
b.HasIndex("InterestId");
|
||||
|
||||
b.ToTable("DiyInterests");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.Interest", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("StudentId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("StudentId");
|
||||
|
||||
b.ToTable("Interests");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.Lesson", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("DateEvent")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<int>("ProductId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("ProductName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("TeacherId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("TeacherName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ProductId");
|
||||
|
||||
b.HasIndex("TeacherId");
|
||||
|
||||
b.ToTable("Lessons");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.LessonMaterial", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("LessonId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("MaterialId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("LessonId");
|
||||
|
||||
b.HasIndex("MaterialId");
|
||||
|
||||
b.ToTable("LessonMaterials");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.Material", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("SphereUse")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("TeacherId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("TeacherId");
|
||||
|
||||
b.ToTable("Materials");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.Product", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("DateCreate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("StudentId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("StudentName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("StudentId");
|
||||
|
||||
b.ToTable("Products");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.ProductInterest", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("InterestId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("ProductId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("InterestId");
|
||||
|
||||
b.HasIndex("ProductId");
|
||||
|
||||
b.ToTable("ProductInterests");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.Student", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("Class")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Login")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Students");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.Task", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("DateDelivery")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<DateTime>("DateIssue")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<int>("TeacherId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("TeacherName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("TeacherId");
|
||||
|
||||
b.ToTable("Tasks");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.TaskMaterial", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("MaterialId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("TaskId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("MaterialId");
|
||||
|
||||
b.HasIndex("TaskId");
|
||||
|
||||
b.ToTable("TaskMaterials");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SchoolAgainStudyDataBaseImplements.Models.Teacher", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Login")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Phone")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("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
|
||||
}
|
||||
}
|
||||
}
|
@ -19,4 +19,8 @@
|
||||
<ProjectReference Include="..\SchoolAgainStudyContracts\SchoolAgainStudyContracts.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Implements\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
Loading…
Reference in New Issue
Block a user