diff --git a/University.sln b/University.sln index 715f482..c38f8ab 100644 --- a/University.sln +++ b/University.sln @@ -13,7 +13,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UniversityContracts", "Univ EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UniversityBusinessLogic", "UniversityBusinessLogic\UniversityBusinessLogic.csproj", "{1F4D08DA-C856-42E5-8E1A-634B6EDB4C9D}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UniversityProvider", "UniversityProvider\UniversityProvider.csproj", "{3EC7CE2C-9D59-4570-B66B-746076D00A03}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UniversityProvider", "UniversityProvider\UniversityProvider.csproj", "{3EC7CE2C-9D59-4570-B66B-746076D00A03}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UniversityRestAPI", "UniversityRestAPI\UniversityRestAPI.csproj", "{24344F5E-3066-4B9B-82FC-F58608D0751D}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -45,6 +47,10 @@ Global {3EC7CE2C-9D59-4570-B66B-746076D00A03}.Debug|Any CPU.Build.0 = Debug|Any CPU {3EC7CE2C-9D59-4570-B66B-746076D00A03}.Release|Any CPU.ActiveCfg = Release|Any CPU {3EC7CE2C-9D59-4570-B66B-746076D00A03}.Release|Any CPU.Build.0 = Release|Any CPU + {24344F5E-3066-4B9B-82FC-F58608D0751D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {24344F5E-3066-4B9B-82FC-F58608D0751D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {24344F5E-3066-4B9B-82FC-F58608D0751D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {24344F5E-3066-4B9B-82FC-F58608D0751D}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/UniversityDataBaseImplemet/Database.cs b/UniversityDataBaseImplemet/Database.cs index a9a5f1c..98b3dbd 100644 --- a/UniversityDataBaseImplemet/Database.cs +++ b/UniversityDataBaseImplemet/Database.cs @@ -10,7 +10,7 @@ namespace UniversityDataBaseImplemet { if (optionsBuilder.IsConfigured == false) { - optionsBuilder.UseNpgsql("Host=localhost;Port=5432;Database=University;Username=postgres;Password=postgres"); + optionsBuilder.UseNpgsql("Host=localhost;Port=5432;Database=University;Username=postgres;Password=123"); } base.OnConfiguring(optionsBuilder); } diff --git a/UniversityDataBaseImplemet/Migrations/20230515162605_lastStageStart.Designer.cs b/UniversityDataBaseImplemet/Migrations/20230515162605_lastStageStart.Designer.cs new file mode 100644 index 0000000..8fcd9b7 --- /dev/null +++ b/UniversityDataBaseImplemet/Migrations/20230515162605_lastStageStart.Designer.cs @@ -0,0 +1,539 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; +using UniversityDataBaseImplemet; + +#nullable disable + +namespace UniversityDataBaseImplemet.Migrations +{ + [DbContext(typeof(Database))] + [Migration("20230515162605_lastStageStart")] + partial class lastStageStart + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.5") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("UniversityDataBaseImplemet.Models.Discipline", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Hours") + .HasColumnType("integer"); + + b.Property("MarkType") + .HasColumnType("boolean"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("StreamId") + .HasColumnType("integer"); + + b.Property("UserId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("StreamId"); + + b.HasIndex("UserId"); + + b.ToTable("Discipline"); + }); + + modelBuilder.Entity("UniversityDataBaseImplemet.Models.Document", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Date") + .HasColumnType("timestamp with time zone"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("Documents"); + }); + + modelBuilder.Entity("UniversityDataBaseImplemet.Models.EducationGroup", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("NumberOfStudent") + .HasColumnType("integer"); + + b.Property("UserId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("EducationGroups"); + }); + + modelBuilder.Entity("UniversityDataBaseImplemet.Models.EducationGroupDocument", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("DocumentId") + .HasColumnType("integer"); + + b.Property("EducationGroupId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("DocumentId"); + + b.HasIndex("EducationGroupId"); + + b.ToTable("EducationGroupsDocuments"); + }); + + modelBuilder.Entity("UniversityDataBaseImplemet.Models.EducationGroupStream", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("EducationGroupId") + .HasColumnType("integer"); + + b.Property("StreamId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("EducationGroupId"); + + b.HasIndex("StreamId"); + + b.ToTable("EducationGroupsStreams"); + }); + + modelBuilder.Entity("UniversityDataBaseImplemet.Models.EducationStatus", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("EducationStatuses"); + }); + + modelBuilder.Entity("UniversityDataBaseImplemet.Models.Role", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("Roles"); + }); + + modelBuilder.Entity("UniversityDataBaseImplemet.Models.Stream", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Course") + .HasColumnType("integer"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("Streams"); + }); + + modelBuilder.Entity("UniversityDataBaseImplemet.Models.Student", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("DateOfBirth") + .HasColumnType("timestamp with time zone"); + + b.Property("EducationStatusId") + .HasColumnType("integer"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("StudentCard") + .HasColumnType("integer"); + + b.Property("Surname") + .IsRequired() + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("EducationStatusId"); + + b.HasIndex("UserId"); + + b.ToTable("Students"); + }); + + modelBuilder.Entity("UniversityDataBaseImplemet.Models.StudentDocument", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("DocumentId") + .HasColumnType("integer"); + + b.Property("StudentId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("DocumentId"); + + b.HasIndex("StudentId"); + + b.ToTable("StudentDocuments"); + }); + + modelBuilder.Entity("UniversityDataBaseImplemet.Models.StudentStream", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("StreamId") + .HasColumnType("integer"); + + b.Property("StudentId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("StreamId"); + + b.HasIndex("StudentId"); + + b.ToTable("StudentStreams"); + }); + + modelBuilder.Entity("UniversityDataBaseImplemet.Models.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Login") + .IsRequired() + .HasColumnType("text"); + + b.Property("Password") + .IsRequired() + .HasColumnType("text"); + + b.Property("RoleId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("User"); + }); + + modelBuilder.Entity("UniversityDataBaseImplemet.Models.Discipline", b => + { + b.HasOne("UniversityDataBaseImplemet.Models.Stream", "Stream") + .WithMany() + .HasForeignKey("StreamId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("UniversityDataBaseImplemet.Models.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Stream"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("UniversityDataBaseImplemet.Models.Document", b => + { + b.HasOne("UniversityDataBaseImplemet.Models.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("User"); + }); + + modelBuilder.Entity("UniversityDataBaseImplemet.Models.EducationGroup", b => + { + b.HasOne("UniversityDataBaseImplemet.Models.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("User"); + }); + + modelBuilder.Entity("UniversityDataBaseImplemet.Models.EducationGroupDocument", b => + { + b.HasOne("UniversityDataBaseImplemet.Models.Document", "Document") + .WithMany("EducationGroupDocument") + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("UniversityDataBaseImplemet.Models.EducationGroup", "EducationGroup") + .WithMany("EducationGroupDocument") + .HasForeignKey("EducationGroupId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Document"); + + b.Navigation("EducationGroup"); + }); + + modelBuilder.Entity("UniversityDataBaseImplemet.Models.EducationGroupStream", b => + { + b.HasOne("UniversityDataBaseImplemet.Models.EducationGroup", "EducationGroup") + .WithMany("EducationGroupStream") + .HasForeignKey("EducationGroupId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("UniversityDataBaseImplemet.Models.Stream", "Stream") + .WithMany("EducationGroupStream") + .HasForeignKey("StreamId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("EducationGroup"); + + b.Navigation("Stream"); + }); + + modelBuilder.Entity("UniversityDataBaseImplemet.Models.EducationStatus", b => + { + b.HasOne("UniversityDataBaseImplemet.Models.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("User"); + }); + + modelBuilder.Entity("UniversityDataBaseImplemet.Models.Stream", b => + { + b.HasOne("UniversityDataBaseImplemet.Models.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("User"); + }); + + modelBuilder.Entity("UniversityDataBaseImplemet.Models.Student", b => + { + b.HasOne("UniversityDataBaseImplemet.Models.EducationStatus", "EducationStatus") + .WithMany("Students") + .HasForeignKey("EducationStatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("UniversityDataBaseImplemet.Models.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("EducationStatus"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("UniversityDataBaseImplemet.Models.StudentDocument", b => + { + b.HasOne("UniversityDataBaseImplemet.Models.Document", "Document") + .WithMany("Students") + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("UniversityDataBaseImplemet.Models.Student", "Student") + .WithMany("DocumentStudents") + .HasForeignKey("StudentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Document"); + + b.Navigation("Student"); + }); + + modelBuilder.Entity("UniversityDataBaseImplemet.Models.StudentStream", b => + { + b.HasOne("UniversityDataBaseImplemet.Models.Stream", "Stream") + .WithMany("StreamStudents") + .HasForeignKey("StreamId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("UniversityDataBaseImplemet.Models.Student", "Student") + .WithMany("StudentStream") + .HasForeignKey("StudentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Stream"); + + b.Navigation("Student"); + }); + + modelBuilder.Entity("UniversityDataBaseImplemet.Models.User", b => + { + b.HasOne("UniversityDataBaseImplemet.Models.Role", "Role") + .WithMany("Users") + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Role"); + }); + + modelBuilder.Entity("UniversityDataBaseImplemet.Models.Document", b => + { + b.Navigation("EducationGroupDocument"); + + b.Navigation("Students"); + }); + + modelBuilder.Entity("UniversityDataBaseImplemet.Models.EducationGroup", b => + { + b.Navigation("EducationGroupDocument"); + + b.Navigation("EducationGroupStream"); + }); + + modelBuilder.Entity("UniversityDataBaseImplemet.Models.EducationStatus", b => + { + b.Navigation("Students"); + }); + + modelBuilder.Entity("UniversityDataBaseImplemet.Models.Role", b => + { + b.Navigation("Users"); + }); + + modelBuilder.Entity("UniversityDataBaseImplemet.Models.Stream", b => + { + b.Navigation("EducationGroupStream"); + + b.Navigation("StreamStudents"); + }); + + modelBuilder.Entity("UniversityDataBaseImplemet.Models.Student", b => + { + b.Navigation("DocumentStudents"); + + b.Navigation("StudentStream"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/UniversityDataBaseImplemet/Migrations/20230515162605_lastStageStart.cs b/UniversityDataBaseImplemet/Migrations/20230515162605_lastStageStart.cs new file mode 100644 index 0000000..1dc22a8 --- /dev/null +++ b/UniversityDataBaseImplemet/Migrations/20230515162605_lastStageStart.cs @@ -0,0 +1,421 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace UniversityDataBaseImplemet.Migrations +{ + /// + public partial class lastStageStart : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "Roles", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + Name = table.Column(type: "text", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Roles", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "User", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + Login = table.Column(type: "text", nullable: false), + Password = table.Column(type: "text", nullable: false), + RoleId = table.Column(type: "integer", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_User", x => x.Id); + table.ForeignKey( + name: "FK_User_Roles_RoleId", + column: x => x.RoleId, + principalTable: "Roles", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Documents", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + Name = table.Column(type: "text", nullable: false), + Date = table.Column(type: "timestamp with time zone", nullable: false), + UserId = table.Column(type: "integer", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Documents", x => x.Id); + table.ForeignKey( + name: "FK_Documents_User_UserId", + column: x => x.UserId, + principalTable: "User", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "EducationGroups", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + NumberOfStudent = table.Column(type: "integer", nullable: false), + Name = table.Column(type: "text", nullable: false), + UserId = table.Column(type: "integer", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_EducationGroups", x => x.Id); + table.ForeignKey( + name: "FK_EducationGroups_User_UserId", + column: x => x.UserId, + principalTable: "User", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "EducationStatuses", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + Name = table.Column(type: "text", nullable: false), + UserId = table.Column(type: "integer", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_EducationStatuses", x => x.Id); + table.ForeignKey( + name: "FK_EducationStatuses_User_UserId", + column: x => x.UserId, + principalTable: "User", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Streams", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + Name = table.Column(type: "text", nullable: false), + Course = table.Column(type: "integer", nullable: false), + UserId = table.Column(type: "integer", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Streams", x => x.Id); + table.ForeignKey( + name: "FK_Streams_User_UserId", + column: x => x.UserId, + principalTable: "User", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "EducationGroupsDocuments", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + EducationGroupId = table.Column(type: "integer", nullable: false), + DocumentId = table.Column(type: "integer", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_EducationGroupsDocuments", x => x.Id); + table.ForeignKey( + name: "FK_EducationGroupsDocuments_Documents_DocumentId", + column: x => x.DocumentId, + principalTable: "Documents", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_EducationGroupsDocuments_EducationGroups_EducationGroupId", + column: x => x.EducationGroupId, + principalTable: "EducationGroups", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Students", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + Name = table.Column(type: "text", nullable: false), + Surname = table.Column(type: "text", nullable: false), + DateOfBirth = table.Column(type: "timestamp with time zone", nullable: false), + StudentCard = table.Column(type: "integer", nullable: false), + EducationStatusId = table.Column(type: "integer", nullable: false), + UserId = table.Column(type: "integer", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Students", x => x.Id); + table.ForeignKey( + name: "FK_Students_EducationStatuses_EducationStatusId", + column: x => x.EducationStatusId, + principalTable: "EducationStatuses", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_Students_User_UserId", + column: x => x.UserId, + principalTable: "User", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Discipline", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + Name = table.Column(type: "text", nullable: false), + UserId = table.Column(type: "integer", nullable: false), + StreamId = table.Column(type: "integer", nullable: false), + Hours = table.Column(type: "integer", nullable: false), + MarkType = table.Column(type: "boolean", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Discipline", x => x.Id); + table.ForeignKey( + name: "FK_Discipline_Streams_StreamId", + column: x => x.StreamId, + principalTable: "Streams", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_Discipline_User_UserId", + column: x => x.UserId, + principalTable: "User", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "EducationGroupsStreams", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + EducationGroupId = table.Column(type: "integer", nullable: false), + StreamId = table.Column(type: "integer", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_EducationGroupsStreams", x => x.Id); + table.ForeignKey( + name: "FK_EducationGroupsStreams_EducationGroups_EducationGroupId", + column: x => x.EducationGroupId, + principalTable: "EducationGroups", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_EducationGroupsStreams_Streams_StreamId", + column: x => x.StreamId, + principalTable: "Streams", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "StudentDocuments", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + StudentId = table.Column(type: "integer", nullable: false), + DocumentId = table.Column(type: "integer", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_StudentDocuments", x => x.Id); + table.ForeignKey( + name: "FK_StudentDocuments_Documents_DocumentId", + column: x => x.DocumentId, + principalTable: "Documents", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_StudentDocuments_Students_StudentId", + column: x => x.StudentId, + principalTable: "Students", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "StudentStreams", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + StudentId = table.Column(type: "integer", nullable: false), + StreamId = table.Column(type: "integer", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_StudentStreams", x => x.Id); + table.ForeignKey( + name: "FK_StudentStreams_Streams_StreamId", + column: x => x.StreamId, + principalTable: "Streams", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_StudentStreams_Students_StudentId", + column: x => x.StudentId, + principalTable: "Students", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_Discipline_StreamId", + table: "Discipline", + column: "StreamId"); + + migrationBuilder.CreateIndex( + name: "IX_Discipline_UserId", + table: "Discipline", + column: "UserId"); + + migrationBuilder.CreateIndex( + name: "IX_Documents_UserId", + table: "Documents", + column: "UserId"); + + migrationBuilder.CreateIndex( + name: "IX_EducationGroups_UserId", + table: "EducationGroups", + column: "UserId"); + + migrationBuilder.CreateIndex( + name: "IX_EducationGroupsDocuments_DocumentId", + table: "EducationGroupsDocuments", + column: "DocumentId"); + + migrationBuilder.CreateIndex( + name: "IX_EducationGroupsDocuments_EducationGroupId", + table: "EducationGroupsDocuments", + column: "EducationGroupId"); + + migrationBuilder.CreateIndex( + name: "IX_EducationGroupsStreams_EducationGroupId", + table: "EducationGroupsStreams", + column: "EducationGroupId"); + + migrationBuilder.CreateIndex( + name: "IX_EducationGroupsStreams_StreamId", + table: "EducationGroupsStreams", + column: "StreamId"); + + migrationBuilder.CreateIndex( + name: "IX_EducationStatuses_UserId", + table: "EducationStatuses", + column: "UserId"); + + migrationBuilder.CreateIndex( + name: "IX_Streams_UserId", + table: "Streams", + column: "UserId"); + + migrationBuilder.CreateIndex( + name: "IX_StudentDocuments_DocumentId", + table: "StudentDocuments", + column: "DocumentId"); + + migrationBuilder.CreateIndex( + name: "IX_StudentDocuments_StudentId", + table: "StudentDocuments", + column: "StudentId"); + + migrationBuilder.CreateIndex( + name: "IX_Students_EducationStatusId", + table: "Students", + column: "EducationStatusId"); + + migrationBuilder.CreateIndex( + name: "IX_Students_UserId", + table: "Students", + column: "UserId"); + + migrationBuilder.CreateIndex( + name: "IX_StudentStreams_StreamId", + table: "StudentStreams", + column: "StreamId"); + + migrationBuilder.CreateIndex( + name: "IX_StudentStreams_StudentId", + table: "StudentStreams", + column: "StudentId"); + + migrationBuilder.CreateIndex( + name: "IX_User_RoleId", + table: "User", + column: "RoleId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "Discipline"); + + migrationBuilder.DropTable( + name: "EducationGroupsDocuments"); + + migrationBuilder.DropTable( + name: "EducationGroupsStreams"); + + migrationBuilder.DropTable( + name: "StudentDocuments"); + + migrationBuilder.DropTable( + name: "StudentStreams"); + + migrationBuilder.DropTable( + name: "EducationGroups"); + + migrationBuilder.DropTable( + name: "Documents"); + + migrationBuilder.DropTable( + name: "Streams"); + + migrationBuilder.DropTable( + name: "Students"); + + migrationBuilder.DropTable( + name: "EducationStatuses"); + + migrationBuilder.DropTable( + name: "User"); + + migrationBuilder.DropTable( + name: "Roles"); + } + } +} diff --git a/UniversityDataBaseImplemet/Migrations/DatabaseModelSnapshot.cs b/UniversityDataBaseImplemet/Migrations/DatabaseModelSnapshot.cs new file mode 100644 index 0000000..34d27b9 --- /dev/null +++ b/UniversityDataBaseImplemet/Migrations/DatabaseModelSnapshot.cs @@ -0,0 +1,536 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; +using UniversityDataBaseImplemet; + +#nullable disable + +namespace UniversityDataBaseImplemet.Migrations +{ + [DbContext(typeof(Database))] + partial class DatabaseModelSnapshot : ModelSnapshot + { + protected override void BuildModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.5") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("UniversityDataBaseImplemet.Models.Discipline", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Hours") + .HasColumnType("integer"); + + b.Property("MarkType") + .HasColumnType("boolean"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("StreamId") + .HasColumnType("integer"); + + b.Property("UserId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("StreamId"); + + b.HasIndex("UserId"); + + b.ToTable("Discipline"); + }); + + modelBuilder.Entity("UniversityDataBaseImplemet.Models.Document", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Date") + .HasColumnType("timestamp with time zone"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("Documents"); + }); + + modelBuilder.Entity("UniversityDataBaseImplemet.Models.EducationGroup", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("NumberOfStudent") + .HasColumnType("integer"); + + b.Property("UserId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("EducationGroups"); + }); + + modelBuilder.Entity("UniversityDataBaseImplemet.Models.EducationGroupDocument", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("DocumentId") + .HasColumnType("integer"); + + b.Property("EducationGroupId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("DocumentId"); + + b.HasIndex("EducationGroupId"); + + b.ToTable("EducationGroupsDocuments"); + }); + + modelBuilder.Entity("UniversityDataBaseImplemet.Models.EducationGroupStream", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("EducationGroupId") + .HasColumnType("integer"); + + b.Property("StreamId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("EducationGroupId"); + + b.HasIndex("StreamId"); + + b.ToTable("EducationGroupsStreams"); + }); + + modelBuilder.Entity("UniversityDataBaseImplemet.Models.EducationStatus", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("EducationStatuses"); + }); + + modelBuilder.Entity("UniversityDataBaseImplemet.Models.Role", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("Roles"); + }); + + modelBuilder.Entity("UniversityDataBaseImplemet.Models.Stream", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Course") + .HasColumnType("integer"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("Streams"); + }); + + modelBuilder.Entity("UniversityDataBaseImplemet.Models.Student", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("DateOfBirth") + .HasColumnType("timestamp with time zone"); + + b.Property("EducationStatusId") + .HasColumnType("integer"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("StudentCard") + .HasColumnType("integer"); + + b.Property("Surname") + .IsRequired() + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("EducationStatusId"); + + b.HasIndex("UserId"); + + b.ToTable("Students"); + }); + + modelBuilder.Entity("UniversityDataBaseImplemet.Models.StudentDocument", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("DocumentId") + .HasColumnType("integer"); + + b.Property("StudentId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("DocumentId"); + + b.HasIndex("StudentId"); + + b.ToTable("StudentDocuments"); + }); + + modelBuilder.Entity("UniversityDataBaseImplemet.Models.StudentStream", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("StreamId") + .HasColumnType("integer"); + + b.Property("StudentId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("StreamId"); + + b.HasIndex("StudentId"); + + b.ToTable("StudentStreams"); + }); + + modelBuilder.Entity("UniversityDataBaseImplemet.Models.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Login") + .IsRequired() + .HasColumnType("text"); + + b.Property("Password") + .IsRequired() + .HasColumnType("text"); + + b.Property("RoleId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("User"); + }); + + modelBuilder.Entity("UniversityDataBaseImplemet.Models.Discipline", b => + { + b.HasOne("UniversityDataBaseImplemet.Models.Stream", "Stream") + .WithMany() + .HasForeignKey("StreamId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("UniversityDataBaseImplemet.Models.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Stream"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("UniversityDataBaseImplemet.Models.Document", b => + { + b.HasOne("UniversityDataBaseImplemet.Models.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("User"); + }); + + modelBuilder.Entity("UniversityDataBaseImplemet.Models.EducationGroup", b => + { + b.HasOne("UniversityDataBaseImplemet.Models.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("User"); + }); + + modelBuilder.Entity("UniversityDataBaseImplemet.Models.EducationGroupDocument", b => + { + b.HasOne("UniversityDataBaseImplemet.Models.Document", "Document") + .WithMany("EducationGroupDocument") + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("UniversityDataBaseImplemet.Models.EducationGroup", "EducationGroup") + .WithMany("EducationGroupDocument") + .HasForeignKey("EducationGroupId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Document"); + + b.Navigation("EducationGroup"); + }); + + modelBuilder.Entity("UniversityDataBaseImplemet.Models.EducationGroupStream", b => + { + b.HasOne("UniversityDataBaseImplemet.Models.EducationGroup", "EducationGroup") + .WithMany("EducationGroupStream") + .HasForeignKey("EducationGroupId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("UniversityDataBaseImplemet.Models.Stream", "Stream") + .WithMany("EducationGroupStream") + .HasForeignKey("StreamId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("EducationGroup"); + + b.Navigation("Stream"); + }); + + modelBuilder.Entity("UniversityDataBaseImplemet.Models.EducationStatus", b => + { + b.HasOne("UniversityDataBaseImplemet.Models.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("User"); + }); + + modelBuilder.Entity("UniversityDataBaseImplemet.Models.Stream", b => + { + b.HasOne("UniversityDataBaseImplemet.Models.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("User"); + }); + + modelBuilder.Entity("UniversityDataBaseImplemet.Models.Student", b => + { + b.HasOne("UniversityDataBaseImplemet.Models.EducationStatus", "EducationStatus") + .WithMany("Students") + .HasForeignKey("EducationStatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("UniversityDataBaseImplemet.Models.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("EducationStatus"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("UniversityDataBaseImplemet.Models.StudentDocument", b => + { + b.HasOne("UniversityDataBaseImplemet.Models.Document", "Document") + .WithMany("Students") + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("UniversityDataBaseImplemet.Models.Student", "Student") + .WithMany("DocumentStudents") + .HasForeignKey("StudentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Document"); + + b.Navigation("Student"); + }); + + modelBuilder.Entity("UniversityDataBaseImplemet.Models.StudentStream", b => + { + b.HasOne("UniversityDataBaseImplemet.Models.Stream", "Stream") + .WithMany("StreamStudents") + .HasForeignKey("StreamId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("UniversityDataBaseImplemet.Models.Student", "Student") + .WithMany("StudentStream") + .HasForeignKey("StudentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Stream"); + + b.Navigation("Student"); + }); + + modelBuilder.Entity("UniversityDataBaseImplemet.Models.User", b => + { + b.HasOne("UniversityDataBaseImplemet.Models.Role", "Role") + .WithMany("Users") + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Role"); + }); + + modelBuilder.Entity("UniversityDataBaseImplemet.Models.Document", b => + { + b.Navigation("EducationGroupDocument"); + + b.Navigation("Students"); + }); + + modelBuilder.Entity("UniversityDataBaseImplemet.Models.EducationGroup", b => + { + b.Navigation("EducationGroupDocument"); + + b.Navigation("EducationGroupStream"); + }); + + modelBuilder.Entity("UniversityDataBaseImplemet.Models.EducationStatus", b => + { + b.Navigation("Students"); + }); + + modelBuilder.Entity("UniversityDataBaseImplemet.Models.Role", b => + { + b.Navigation("Users"); + }); + + modelBuilder.Entity("UniversityDataBaseImplemet.Models.Stream", b => + { + b.Navigation("EducationGroupStream"); + + b.Navigation("StreamStudents"); + }); + + modelBuilder.Entity("UniversityDataBaseImplemet.Models.Student", b => + { + b.Navigation("DocumentStudents"); + + b.Navigation("StudentStream"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/UniversityDataBaseImplemet/UniversityDataBaseImplemet.csproj b/UniversityDataBaseImplemet/UniversityDataBaseImplemet.csproj index e9aeb03..a4d5627 100644 --- a/UniversityDataBaseImplemet/UniversityDataBaseImplemet.csproj +++ b/UniversityDataBaseImplemet/UniversityDataBaseImplemet.csproj @@ -11,8 +11,10 @@ - - + + + + diff --git a/UniversityProvider/UniversityProvider.csproj b/UniversityProvider/UniversityProvider.csproj index 8a7e613..4ef3874 100644 --- a/UniversityProvider/UniversityProvider.csproj +++ b/UniversityProvider/UniversityProvider.csproj @@ -6,8 +6,16 @@ enable + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + diff --git a/UniversityProvider/Views/Home/Students.cshtml b/UniversityProvider/Views/Home/Students.cshtml index d80ff8f..8996d8e 100644 --- a/UniversityProvider/Views/Home/Students.cshtml +++ b/UniversityProvider/Views/Home/Students.cshtml @@ -1,6 +1,5 @@ @using UniversityContracts.ViewModels @model List -@model List @{ ViewData["Title"] = "Студенты"; diff --git a/UniversityRestAPI/Program.cs b/UniversityRestAPI/Program.cs new file mode 100644 index 0000000..722e032 --- /dev/null +++ b/UniversityRestAPI/Program.cs @@ -0,0 +1,39 @@ +using Microsoft.OpenApi.Models; +using UniversityBusinessLogic.BusinessLogics; +using UniversityContracts.BusinessLogicContracts; +using UniversityContracts.StoragesContracts; +using UniversityDataBaseImplemet.Implements; + +var builder = WebApplication.CreateBuilder(args); + + +// Add services to the container. +builder.Services.AddTransient(); + +builder.Services.AddTransient(); + +builder.Services.AddControllers(); + +// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle +builder.Services.AddEndpointsApiExplorer(); +builder.Services.AddSwaggerGen(c => +{ + c.SwaggerDoc("v1", new OpenApiInfo { Title = "UniversityRestApi", Version = "v1" }); +}); + +var app = builder.Build(); + +// Configure the HTTP request pipeline. +if (app.Environment.IsDevelopment()) +{ + app.UseSwagger(); + app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "UniversityRestApi")); +} + +app.UseHttpsRedirection(); + +app.UseAuthorization(); + +app.MapControllers(); + +app.Run(); \ No newline at end of file diff --git a/UniversityRestAPI/Properties/launchSettings.json b/UniversityRestAPI/Properties/launchSettings.json new file mode 100644 index 0000000..6828004 --- /dev/null +++ b/UniversityRestAPI/Properties/launchSettings.json @@ -0,0 +1,31 @@ +{ + "$schema": "https://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:57564", + "sslPort": 44321 + } + }, + "profiles": { + "UniversityRestAPI": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "launchUrl": "swagger", + "applicationUrl": "https://localhost:7038;http://localhost:5067", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "launchUrl": "swagger", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/UniversityRestAPI/UniversityRestAPI.csproj b/UniversityRestAPI/UniversityRestAPI.csproj new file mode 100644 index 0000000..09cc487 --- /dev/null +++ b/UniversityRestAPI/UniversityRestAPI.csproj @@ -0,0 +1,23 @@ + + + + net6.0 + enable + enable + + + + + + + + + + + + + + + + + diff --git a/UniversityRestAPI/appsettings.Development.json b/UniversityRestAPI/appsettings.Development.json new file mode 100644 index 0000000..0c208ae --- /dev/null +++ b/UniversityRestAPI/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/UniversityRestAPI/appsettings.json b/UniversityRestAPI/appsettings.json new file mode 100644 index 0000000..10f68b8 --- /dev/null +++ b/UniversityRestAPI/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +}