add modelas and implements files
This commit is contained in:
parent
3ca8f0c7d2
commit
41dc907c53
12
University/DatabaseImplement/Implements/ActivityStorage.cs
Normal file
12
University/DatabaseImplement/Implements/ActivityStorage.cs
Normal file
@ -0,0 +1,12 @@
|
||||
using UniversityContracts.BindingModels;
|
||||
using UniversityContracts.SearchModels;
|
||||
using UniversityContracts.StoragesContracts;
|
||||
using UniversityContracts.ViewModels;
|
||||
using UniversityDatabaseImplement.Models;
|
||||
|
||||
namespace UniversityDatabaseImplement.Implements
|
||||
{
|
||||
internal class ActivityStorage : IActivityStorage
|
||||
{
|
||||
}
|
||||
}
|
12
University/DatabaseImplement/Implements/DisciplineStorage.cs
Normal file
12
University/DatabaseImplement/Implements/DisciplineStorage.cs
Normal file
@ -0,0 +1,12 @@
|
||||
using UniversityContracts.BindingModels;
|
||||
using UniversityContracts.SearchModels;
|
||||
using UniversityContracts.StoragesContracts;
|
||||
using UniversityContracts.ViewModels;
|
||||
using UniversityDatabaseImplement.Models;
|
||||
|
||||
namespace UniversityDatabaseImplement.Implements
|
||||
{
|
||||
internal class DisciplineStorage : IDisciplineStorage
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
using UniversityContracts.BindingModels;
|
||||
using UniversityContracts.SearchModels;
|
||||
using UniversityContracts.StoragesContracts;
|
||||
using UniversityContracts.ViewModels;
|
||||
using UniversityDatabaseImplement.Models;
|
||||
|
||||
namespace UniversityDatabaseImplement.Implements
|
||||
{
|
||||
internal class ExaminationResultStorage : IExaminationResultStorage
|
||||
{
|
||||
}
|
||||
}
|
12
University/DatabaseImplement/Implements/ReportTypeStorage.cs
Normal file
12
University/DatabaseImplement/Implements/ReportTypeStorage.cs
Normal file
@ -0,0 +1,12 @@
|
||||
using UniversityContracts.BindingModels;
|
||||
using UniversityContracts.SearchModels;
|
||||
using UniversityContracts.StoragesContracts;
|
||||
using UniversityContracts.ViewModels;
|
||||
using UniversityDatabaseImplement.Models;
|
||||
|
||||
namespace UniversityDatabaseImplement.Implements
|
||||
{
|
||||
internal class ReportTypeStorage : IReportTypeStorage
|
||||
{
|
||||
}
|
||||
}
|
12
University/DatabaseImplement/Implements/StatementStorage.cs
Normal file
12
University/DatabaseImplement/Implements/StatementStorage.cs
Normal file
@ -0,0 +1,12 @@
|
||||
using UniversityContracts.BindingModels;
|
||||
using UniversityContracts.SearchModels;
|
||||
using UniversityContracts.StoragesContracts;
|
||||
using UniversityContracts.ViewModels;
|
||||
using UniversityDatabaseImplement.Models;
|
||||
|
||||
namespace UniversityDatabaseImplement.Implements
|
||||
{
|
||||
internal class StatementStorage : IStatementStorage
|
||||
{
|
||||
}
|
||||
}
|
12
University/DatabaseImplement/Implements/StudentStorage.cs
Normal file
12
University/DatabaseImplement/Implements/StudentStorage.cs
Normal file
@ -0,0 +1,12 @@
|
||||
using UniversityContracts.BindingModels;
|
||||
using UniversityContracts.SearchModels;
|
||||
using UniversityContracts.StoragesContracts;
|
||||
using UniversityContracts.ViewModels;
|
||||
using UniversityDatabaseImplement.Models;
|
||||
|
||||
namespace UniversityDatabaseImplement.Implements
|
||||
{
|
||||
internal class StudentStorage : IStudentStorage
|
||||
{
|
||||
}
|
||||
}
|
19
University/DatabaseImplement/Models/Activity.cs
Normal file
19
University/DatabaseImplement/Models/Activity.cs
Normal file
@ -0,0 +1,19 @@
|
||||
using UniversityContracts.BindingModels;
|
||||
using UniversityContracts.ViewModels;
|
||||
using UniversityDataModels.Models;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace UniversityDatabaseImplement.Models
|
||||
{
|
||||
public class Activity : IActivityModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
[Required]
|
||||
public DateTime Date { get; set; }
|
||||
[Required]
|
||||
public int Number { get; set; }
|
||||
[ForeignKey("ActivityId")]
|
||||
public virtual List<ReportTypeActivity> ReportTypeActivities { get; set; } = new();
|
||||
}
|
||||
}
|
21
University/DatabaseImplement/Models/Discipline.cs
Normal file
21
University/DatabaseImplement/Models/Discipline.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using UniversityContracts.BindingModels;
|
||||
using UniversityContracts.ViewModels;
|
||||
using UniversityDataModels.Models;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace UniversityDatabaseImplement.Models
|
||||
{
|
||||
public class Discipline : IDisciplineModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
[Required]
|
||||
public string Name { get; set; }
|
||||
[Required]
|
||||
public string Department { get; set; }
|
||||
[ForeignKey("DisciplineId")]
|
||||
public virtual List<Statement> Statements { get; set; } = new();
|
||||
[ForeignKey("DisciplineId")]
|
||||
public virtual List<ReportTypeDiscipline> ReportTypeDisciplines { get; set; } = new();
|
||||
}
|
||||
}
|
23
University/DatabaseImplement/Models/ExaminationResult.cs
Normal file
23
University/DatabaseImplement/Models/ExaminationResult.cs
Normal file
@ -0,0 +1,23 @@
|
||||
using UniversityContracts.BindingModels;
|
||||
using UniversityContracts.ViewModels;
|
||||
using UniversityDataModels.Models;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using UniversityDataModels.Enums;
|
||||
|
||||
namespace UniversityDatabaseImplement.Models
|
||||
{
|
||||
public class ExaminationResult : IExaminationResultModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string ExaminationForm { get; set; }
|
||||
[Required]
|
||||
public MarkType Mark { get; set; }
|
||||
[Required]
|
||||
public DateTime Date { get; set; }
|
||||
[ForeignKey("ExaminationResultId")]
|
||||
public virtual List<Activity> Activities { get; set; } = new();
|
||||
[ForeignKey("ExaminationResultId")]
|
||||
public virtual List<StudentExaminationResult> StudentExaminationResults { get; set; } = new();
|
||||
}
|
||||
}
|
19
University/DatabaseImplement/Models/ReportType.cs
Normal file
19
University/DatabaseImplement/Models/ReportType.cs
Normal file
@ -0,0 +1,19 @@
|
||||
using UniversityContracts.BindingModels;
|
||||
using UniversityContracts.ViewModels;
|
||||
using UniversityDataModels.Models;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace UniversityDatabaseImplement.Models
|
||||
{
|
||||
public class ReportType : IReportTypeModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
[Required]
|
||||
public string Name { get; set; }
|
||||
[ForeignKey("ReportTypeId")]
|
||||
public virtual List<ReportTypeActivity> ReportTypeActivities { get; set; } = new();
|
||||
[ForeignKey("ReportTypeId")]
|
||||
public virtual List<ReportTypeDiscipline> ReportTypeDisciplines { get; set; } = new();
|
||||
}
|
||||
}
|
16
University/DatabaseImplement/Models/ReportTypeActivity.cs
Normal file
16
University/DatabaseImplement/Models/ReportTypeActivity.cs
Normal file
@ -0,0 +1,16 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace UniversityDatabaseImplement.Models
|
||||
{
|
||||
public class ReportTypeActivity
|
||||
{
|
||||
public int Id { get; set; }
|
||||
[Required]
|
||||
public int ReportTypeId { get; set; }
|
||||
[Required]
|
||||
public int ActivityId { get; set; }
|
||||
public virtual ReportType ReportType { get; set; } = new();
|
||||
public virtual Activity Activity { get; set; } = new();
|
||||
|
||||
}
|
||||
}
|
15
University/DatabaseImplement/Models/ReportTypeDiscipline.cs
Normal file
15
University/DatabaseImplement/Models/ReportTypeDiscipline.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace UniversityDatabaseImplement.Models
|
||||
{
|
||||
public class ReportTypeDiscipline
|
||||
{
|
||||
public int Id { get; set; }
|
||||
[Required]
|
||||
public int ReportTypeId { get; set; }
|
||||
[Required]
|
||||
public int DisciplineId { get; set; }
|
||||
public virtual ReportType ReportType { get; set; } = new();
|
||||
public virtual Discipline Discipline { get; set; } = new();
|
||||
}
|
||||
}
|
21
University/DatabaseImplement/Models/Statement.cs
Normal file
21
University/DatabaseImplement/Models/Statement.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using UniversityContracts.BindingModels;
|
||||
using UniversityContracts.ViewModels;
|
||||
using UniversityDataModels.Models;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace UniversityDatabaseImplement.Models
|
||||
{
|
||||
public class Statement : IStatementModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
[Required]
|
||||
public DateTime Date { get; set; }
|
||||
[Required]
|
||||
public int HoursCount { get; set; }
|
||||
[ForeignKey("StatementId")]
|
||||
public virtual List<StatementStudent> StatementStudents { get; set; } = new();
|
||||
[ForeignKey("StatementId")]
|
||||
public virtual List<ExaminationResult> ExaminationResults { get; set; } = new();
|
||||
}
|
||||
}
|
15
University/DatabaseImplement/Models/StatementStudent.cs
Normal file
15
University/DatabaseImplement/Models/StatementStudent.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace UniversityDatabaseImplement.Models
|
||||
{
|
||||
public class StatementStudent
|
||||
{
|
||||
public int Id { get; set; }
|
||||
[Required]
|
||||
public int StudentTypeId { get; set; }
|
||||
[Required]
|
||||
public int StatementId { get; set; }
|
||||
public virtual Student Student { get; set; } = new();
|
||||
public virtual Statement Statement { get; set; } = new();
|
||||
}
|
||||
}
|
21
University/DatabaseImplement/Models/Student.cs
Normal file
21
University/DatabaseImplement/Models/Student.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using UniversityContracts.BindingModels;
|
||||
using UniversityContracts.ViewModels;
|
||||
using UniversityDataModels.Models;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace UniversityDatabaseImplement.Models
|
||||
{
|
||||
public class Student : IStudentModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
[Required]
|
||||
public string Name { get; set; }
|
||||
[Required]
|
||||
public string RecordCardNumber { get; set; }
|
||||
[ForeignKey("StudentId")]
|
||||
public virtual List<StatementStudent> StatementStudents { get; set; } = new();
|
||||
[ForeignKey("StudentId")]
|
||||
public virtual List<StudentExaminationResult> StudentExaminationResults { get; set; } = new();
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace UniversityDatabaseImplement.Models
|
||||
{
|
||||
public class StudentExaminationResult
|
||||
{
|
||||
public int Id { get; set; }
|
||||
[Required]
|
||||
public int ExaminationResultId { get; set; }
|
||||
[Required]
|
||||
public int StudentId { get; set; }
|
||||
public virtual ExaminationResult ExaminationResult { get; set; } = new();
|
||||
public virtual Student Student { get; set; } = new();
|
||||
}
|
||||
}
|
27
University/DatabaseImplement/UniversityDatabase.cs
Normal file
27
University/DatabaseImplement/UniversityDatabase.cs
Normal file
@ -0,0 +1,27 @@
|
||||
using UniversityDatabaseImplement.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace PizzeriaDatabaseImplement
|
||||
{
|
||||
public class PizzeriaDatabase : DbContext
|
||||
{
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
{
|
||||
if (optionsBuilder.IsConfigured == false)
|
||||
{
|
||||
optionsBuilder.UseNpgsql(@"Host=localhost;Port=5432;Database=UniversityDatabase;Username=postgres;Password=postgres");
|
||||
}
|
||||
base.OnConfiguring(optionsBuilder);
|
||||
}
|
||||
public virtual DbSet<Activity> Activity { set; get; }
|
||||
public virtual DbSet<Discipline> Discipline { set; get; }
|
||||
public virtual DbSet<ExaminationResult> ExaminationResult { set; get; }
|
||||
public virtual DbSet<ReportType> ReportType { set; get; }
|
||||
public virtual DbSet<ReportTypeActivity> ReportTypeActivity { set; get; }
|
||||
public virtual DbSet<ReportTypeDiscipline> ReportTypeDiscipline { set; get; }
|
||||
public virtual DbSet<Statement> Statement { set; get; }
|
||||
public virtual DbSet<StatementStudent> StatementStudent { set; get; }
|
||||
public virtual DbSet<Student> Student { set; get; }
|
||||
public virtual DbSet<StudentExaminationResult> StudentExaminationResult { set; get; }
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.4" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.4" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.4">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="7.0.3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\UniversityContracts\UniversityContracts.csproj" />
|
||||
<ProjectReference Include="..\UniversityDataModels\UniversityDataModels.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
@ -5,9 +5,11 @@ VisualStudioVersion = 17.1.32319.34
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "University", "University\University.csproj", "{34B9CDDB-BFE5-48B9-AA3A-1A01D99A765D}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UniversityDataModels", "UniversityDataModels\UniversityDataModels.csproj", "{36B2DE4B-7689-4287-911E-892FCD27AE84}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UniversityDataModels", "UniversityDataModels\UniversityDataModels.csproj", "{36B2DE4B-7689-4287-911E-892FCD27AE84}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UniversityContracts", "UniversityContracts\UniversityContracts.csproj", "{BACEFD46-1073-4730-BC42-15B0D0D359C9}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UniversityContracts", "UniversityContracts\UniversityContracts.csproj", "{BACEFD46-1073-4730-BC42-15B0D0D359C9}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UniversityDatabaseImplement", "DatabaseImplement\UniversityDatabaseImplement.csproj", "{E90DAE97-8D0D-4E8E-89BC-82D3B54DA067}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
@ -27,6 +29,10 @@ Global
|
||||
{BACEFD46-1073-4730-BC42-15B0D0D359C9}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{BACEFD46-1073-4730-BC42-15B0D0D359C9}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{BACEFD46-1073-4730-BC42-15B0D0D359C9}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{E90DAE97-8D0D-4E8E-89BC-82D3B54DA067}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{E90DAE97-8D0D-4E8E-89BC-82D3B54DA067}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{E90DAE97-8D0D-4E8E-89BC-82D3B54DA067}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{E90DAE97-8D0D-4E8E-89BC-82D3B54DA067}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
Loading…
Reference in New Issue
Block a user