diff --git a/Cop.Borovkov.Var3/Cop.Borovkov.Var3.sln b/Cop.Borovkov.Var3/Cop.Borovkov.Var3.sln
index 12f71ea..2f42979 100644
--- a/Cop.Borovkov.Var3/Cop.Borovkov.Var3.sln
+++ b/Cop.Borovkov.Var3/Cop.Borovkov.Var3.sln
@@ -9,6 +9,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestCustomComponents", "Tes
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PIHelperSh.PdfCreator", "PIHelperSh.PdfCreater\PIHelperSh.PdfCreator.csproj", "{572BD835-A500-43C9-A66F-648540F4A1C8}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lab3", "Lab3\Lab3.csproj", "{1E630CC7-090F-471C-ADA1-74107CF3DC2A}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lab3.Database", "Lab3.Database\Lab3.Database.csproj", "{698DE9E8-7885-4F98-AFE3-9A9C6CD2FCF5}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -27,6 +31,14 @@ Global
{572BD835-A500-43C9-A66F-648540F4A1C8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{572BD835-A500-43C9-A66F-648540F4A1C8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{572BD835-A500-43C9-A66F-648540F4A1C8}.Release|Any CPU.Build.0 = Release|Any CPU
+ {1E630CC7-090F-471C-ADA1-74107CF3DC2A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {1E630CC7-090F-471C-ADA1-74107CF3DC2A}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {1E630CC7-090F-471C-ADA1-74107CF3DC2A}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {1E630CC7-090F-471C-ADA1-74107CF3DC2A}.Release|Any CPU.Build.0 = Release|Any CPU
+ {698DE9E8-7885-4F98-AFE3-9A9C6CD2FCF5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {698DE9E8-7885-4F98-AFE3-9A9C6CD2FCF5}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {698DE9E8-7885-4F98-AFE3-9A9C6CD2FCF5}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {698DE9E8-7885-4F98-AFE3-9A9C6CD2FCF5}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/Cop.Borovkov.Var3/Cop.Borovkov.Var3/Cop.Borovkov.Var3.csproj b/Cop.Borovkov.Var3/Cop.Borovkov.Var3/Cop.Borovkov.Var3.csproj
index a56206d..e32cffc 100644
--- a/Cop.Borovkov.Var3/Cop.Borovkov.Var3/Cop.Borovkov.Var3.csproj
+++ b/Cop.Borovkov.Var3/Cop.Borovkov.Var3/Cop.Borovkov.Var3.csproj
@@ -5,6 +5,9 @@
enable
true
enable
+ True
+ $(AssemblyName)
+ $(VersionPrefix)8.0.1
diff --git a/Cop.Borovkov.Var3/Lab3.Database/Context/COPContext.cs b/Cop.Borovkov.Var3/Lab3.Database/Context/COPContext.cs
new file mode 100644
index 0000000..54e01bb
--- /dev/null
+++ b/Cop.Borovkov.Var3/Lab3.Database/Context/COPContext.cs
@@ -0,0 +1,34 @@
+// This file has been auto generated by EF Core Power Tools.
+using Lab3.Database.Context.Configurations;
+using Lab3.Database.Models;
+using Microsoft.EntityFrameworkCore;
+using System;
+using System.Collections.Generic;
+#nullable disable
+
+namespace Lab3.Database.Context;
+
+public partial class COPContext : DbContext
+{
+ public COPContext(DbContextOptions options)
+ : base(options)
+ {
+ }
+
+ public virtual DbSet EducationForms { get; set; }
+
+ public virtual DbSet Students { get; set; }
+
+ public virtual DbSet StudentSessions { get; set; }
+
+ protected override void OnModelCreating(ModelBuilder modelBuilder)
+ {
+ modelBuilder.ApplyConfiguration(new Configurations.EducationFormConfiguration());
+ modelBuilder.ApplyConfiguration(new Configurations.StudentConfiguration());
+ modelBuilder.ApplyConfiguration(new Configurations.StudentSessionConfiguration());
+
+ OnModelCreatingPartial(modelBuilder);
+ }
+
+ partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
+}
diff --git a/Cop.Borovkov.Var3/Lab3.Database/Context/COPContextFunctions.cs b/Cop.Borovkov.Var3/Lab3.Database/Context/COPContextFunctions.cs
new file mode 100644
index 0000000..693a98d
--- /dev/null
+++ b/Cop.Borovkov.Var3/Lab3.Database/Context/COPContextFunctions.cs
@@ -0,0 +1,46 @@
+// This file has been auto generated by EF Core Power Tools.
+#nullable disable
+using Lab3.Database.Models;
+using Microsoft.EntityFrameworkCore;
+using Npgsql;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace Lab3.Database.Context
+{
+ public partial class COPContext
+ {
+ private ICOPContextFunctions _procedures;
+
+ public virtual ICOPContextFunctions Functions
+ {
+ get
+ {
+ if (_procedures is null) _procedures = new COPContextFunctions(this);
+ return _procedures;
+ }
+ set
+ {
+ _procedures = value;
+ }
+ }
+
+ public ICOPContextFunctions GetFunctions()
+ {
+ return Functions;
+ }
+ }
+
+ public partial class COPContextFunctions : ICOPContextFunctions
+ {
+ private readonly COPContext _context;
+
+ public COPContextFunctions(COPContext context)
+ {
+ _context = context;
+ }
+ }
+}
diff --git a/Cop.Borovkov.Var3/Lab3.Database/Context/Configurations/EducationFormConfiguration.cs b/Cop.Borovkov.Var3/Lab3.Database/Context/Configurations/EducationFormConfiguration.cs
new file mode 100644
index 0000000..2e68615
--- /dev/null
+++ b/Cop.Borovkov.Var3/Lab3.Database/Context/Configurations/EducationFormConfiguration.cs
@@ -0,0 +1,31 @@
+// This file has been auto generated by EF Core Power Tools.
+using Lab3.Database.Context;
+using Lab3.Database.Models;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Metadata.Builders;
+using System;
+using System.Collections.Generic;
+
+namespace Lab3.Database.Context.Configurations
+{
+ public partial class EducationFormConfiguration : IEntityTypeConfiguration
+ {
+ public void Configure(EntityTypeBuilder entity)
+ {
+ entity.HasKey(e => e.Id).HasName("EducationForm_pkey");
+
+ entity.ToTable("EducationForm");
+
+ entity.HasIndex(e => e.Name, "EducationForm_Name_Name1_key").IsUnique();
+
+ entity.Property(e => e.Id).ValueGeneratedNever();
+ entity.Property(e => e.Name)
+ .IsRequired()
+ .HasColumnType("character varying");
+
+ OnConfigurePartial(entity);
+ }
+
+ partial void OnConfigurePartial(EntityTypeBuilder entity);
+ }
+}
diff --git a/Cop.Borovkov.Var3/Lab3.Database/Context/Configurations/StartEducationConfiguration.cs b/Cop.Borovkov.Var3/Lab3.Database/Context/Configurations/StartEducationConfiguration.cs
new file mode 100644
index 0000000..c3b3f33
--- /dev/null
+++ b/Cop.Borovkov.Var3/Lab3.Database/Context/Configurations/StartEducationConfiguration.cs
@@ -0,0 +1,31 @@
+// This file has been auto generated by EF Core Power Tools.
+using Lab3.Database.Context;
+using Lab3.Database.Models;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Metadata.Builders;
+using System;
+using System.Collections.Generic;
+
+namespace Lab3.Database.Context.Configurations
+{
+ public partial class StartEducationConfiguration : IEntityTypeConfiguration
+ {
+ public void Configure(EntityTypeBuilder entity)
+ {
+ entity.HasKey(e => e.Id).HasName("StartEducation_pkey");
+
+ entity.ToTable("StartEducation");
+
+ entity.Property(e => e.Id).ValueGeneratedNever();
+ entity.Property(e => e.DateTime).HasColumnType("timestamp without time zone");
+
+ entity.HasOne(d => d.Student).WithMany(p => p.StartEducations)
+ .HasForeignKey(d => d.StudentId)
+ .HasConstraintName("StartEducation_StudentId_fkey");
+
+ OnConfigurePartial(entity);
+ }
+
+ partial void OnConfigurePartial(EntityTypeBuilder entity);
+ }
+}
diff --git a/Cop.Borovkov.Var3/Lab3.Database/Context/Configurations/StudentConfiguration.cs b/Cop.Borovkov.Var3/Lab3.Database/Context/Configurations/StudentConfiguration.cs
new file mode 100644
index 0000000..668ba36
--- /dev/null
+++ b/Cop.Borovkov.Var3/Lab3.Database/Context/Configurations/StudentConfiguration.cs
@@ -0,0 +1,33 @@
+// This file has been auto generated by EF Core Power Tools.
+using Lab3.Database.Context;
+using Lab3.Database.Models;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Metadata.Builders;
+using System;
+using System.Collections.Generic;
+
+namespace Lab3.Database.Context.Configurations
+{
+ public partial class StudentConfiguration : IEntityTypeConfiguration
+ {
+ public void Configure(EntityTypeBuilder entity)
+ {
+ entity.HasKey(e => e.Id).HasName("Student_pkey");
+
+ entity.ToTable("Student");
+
+ entity.Property(e => e.Id).ValueGeneratedNever();
+ entity.Property(e => e.EducationForm)
+ .IsRequired()
+ .HasColumnType("character varying");
+ entity.Property(e => e.Name)
+ .IsRequired()
+ .HasColumnType("character varying");
+ entity.Property(e => e.StartEducation).HasColumnType("timestamp without time zone");
+
+ OnConfigurePartial(entity);
+ }
+
+ partial void OnConfigurePartial(EntityTypeBuilder entity);
+ }
+}
diff --git a/Cop.Borovkov.Var3/Lab3.Database/Context/Configurations/StudentSessionConfiguration.cs b/Cop.Borovkov.Var3/Lab3.Database/Context/Configurations/StudentSessionConfiguration.cs
new file mode 100644
index 0000000..ce05011
--- /dev/null
+++ b/Cop.Borovkov.Var3/Lab3.Database/Context/Configurations/StudentSessionConfiguration.cs
@@ -0,0 +1,30 @@
+// This file has been auto generated by EF Core Power Tools.
+using Lab3.Database.Context;
+using Lab3.Database.Models;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Metadata.Builders;
+using System;
+using System.Collections.Generic;
+
+namespace Lab3.Database.Context.Configurations
+{
+ public partial class StudentSessionConfiguration : IEntityTypeConfiguration
+ {
+ public void Configure(EntityTypeBuilder entity)
+ {
+ entity.HasKey(e => e.Id).HasName("StudentSession_pkey");
+
+ entity.ToTable("StudentSession");
+
+ entity.Property(e => e.Id).ValueGeneratedNever();
+
+ entity.HasOne(d => d.Student).WithMany(p => p.StudentSessions)
+ .HasForeignKey(d => d.StudentId)
+ .HasConstraintName("StudentSession");
+
+ OnConfigurePartial(entity);
+ }
+
+ partial void OnConfigurePartial(EntityTypeBuilder entity);
+ }
+}
diff --git a/Cop.Borovkov.Var3/Lab3.Database/Context/DbContextExtensions.cs b/Cop.Borovkov.Var3/Lab3.Database/Context/DbContextExtensions.cs
new file mode 100644
index 0000000..42072c8
--- /dev/null
+++ b/Cop.Borovkov.Var3/Lab3.Database/Context/DbContextExtensions.cs
@@ -0,0 +1,62 @@
+// This file has been auto generated by EF Core Power Tools.
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Storage;
+using System;
+using System.Collections.Generic;
+using System.Data.Common;
+using System.Linq;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace Lab3.Database.Context
+{
+ public static class DbContextExtensions
+ {
+ public static async Task> SqlQueryAsync(this DbContext db, string sql, object[] parameters = null, CancellationToken cancellationToken = default)
+ where T : class
+ {
+ if (parameters is null)
+ {
+ parameters = new object[] { };
+ }
+
+ if (typeof(T).GetProperties().Any())
+ {
+ return await db.Database
+ .SqlQueryRaw(sql, parameters)
+ .ToListAsync(cancellationToken);
+ }
+ else
+ {
+ await db.Database.ExecuteSqlRawAsync(sql, parameters, cancellationToken);
+ return default;
+ }
+ }
+ }
+
+ public class OutputParameter
+ {
+ private bool _valueSet = false;
+
+ public TValue _value;
+
+ public TValue Value
+ {
+ get
+ {
+ if (!_valueSet)
+ throw new InvalidOperationException("Value not set.");
+
+ return _value;
+ }
+ }
+
+ internal void SetValue(object value)
+ {
+ _valueSet = true;
+
+ _value = null == value || Convert.IsDBNull(value) ? default(TValue) : (TValue)value;
+ }
+ }
+}
diff --git a/Cop.Borovkov.Var3/Lab3.Database/Context/ICOPContextFunctions.cs b/Cop.Borovkov.Var3/Lab3.Database/Context/ICOPContextFunctions.cs
new file mode 100644
index 0000000..4efa29b
--- /dev/null
+++ b/Cop.Borovkov.Var3/Lab3.Database/Context/ICOPContextFunctions.cs
@@ -0,0 +1,17 @@
+// This file has been auto generated by EF Core Power Tools.
+#nullable disable
+using Lab3.Database.Models;
+using Microsoft.EntityFrameworkCore;
+using Npgsql;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace Lab3.Database.Context
+{
+ public partial interface ICOPContextFunctions
+ {
+ }
+}
diff --git a/Cop.Borovkov.Var3/Lab3.Database/DTO/StudentDTO.cs b/Cop.Borovkov.Var3/Lab3.Database/DTO/StudentDTO.cs
new file mode 100644
index 0000000..7b029cf
--- /dev/null
+++ b/Cop.Borovkov.Var3/Lab3.Database/DTO/StudentDTO.cs
@@ -0,0 +1,15 @@
+namespace Lab3.Database.DTO
+{
+ public record StudentDTO
+ {
+ public Guid Id { get; init; }
+
+ public string Name { get; init; } = null!;
+
+ public DateTime StartEducation { get; init; }
+
+ public string EducationForm { get; init; } = null!;
+
+ public List StudentSessions { get; init; } = [];
+ }
+}
diff --git a/Cop.Borovkov.Var3/Lab3.Database/DTO/StudentSessionDTO.cs b/Cop.Borovkov.Var3/Lab3.Database/DTO/StudentSessionDTO.cs
new file mode 100644
index 0000000..8155a74
--- /dev/null
+++ b/Cop.Borovkov.Var3/Lab3.Database/DTO/StudentSessionDTO.cs
@@ -0,0 +1,11 @@
+namespace Lab3.Database.DTO
+{
+ public record StudentSessionDTO
+ {
+ public Guid Id { get; init; }
+
+ public decimal Score { get; init; }
+
+ public int Number { get; init; }
+ }
+}
diff --git a/Cop.Borovkov.Var3/Lab3.Database/Extensions/DIExtension.cs b/Cop.Borovkov.Var3/Lab3.Database/Extensions/DIExtension.cs
new file mode 100644
index 0000000..291cb2d
--- /dev/null
+++ b/Cop.Borovkov.Var3/Lab3.Database/Extensions/DIExtension.cs
@@ -0,0 +1,38 @@
+using Lab3.Database.Context;
+using Lab3.Database.MappingProfiles;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.Extensions.Configuration;
+using Microsoft.Extensions.DependencyInjection;
+
+namespace Lab3.Database.Extensions
+{
+ public static class DiExtension
+ {
+ public static IServiceCollection AddDatabase(
+ this IServiceCollection services,
+ IConfiguration configuration)
+ {
+ services.AddDbContextPool(
+ dbContextOptions =>
+ {
+ AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);
+ AppContext.SetSwitch("Npgsql.DisableDateTimeInfinityConversions", true);
+
+ _ = dbContextOptions.UseNpgsql(configuration.GetConnectionString("COPDataBase"));
+ _ = dbContextOptions.ConfigureWarnings(warnings => { });
+ }
+ );
+
+ return services;
+ }
+
+ public static IServiceCollection AddDbMapping(
+ this IServiceCollection services)
+ {
+ services.AddAutoMapper(typeof(StudentMappingProfile));
+ services.AddAutoMapper(typeof(SessionMappingProfile));
+
+ return services;
+ }
+ }
+}
diff --git a/Cop.Borovkov.Var3/Lab3.Database/Lab3.Database.csproj b/Cop.Borovkov.Var3/Lab3.Database/Lab3.Database.csproj
new file mode 100644
index 0000000..29b0575
--- /dev/null
+++ b/Cop.Borovkov.Var3/Lab3.Database/Lab3.Database.csproj
@@ -0,0 +1,18 @@
+
+
+
+ net8.0
+ enable
+ enable
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Cop.Borovkov.Var3/Lab3.Database/MappingProfiles/SessionMappingProfile.cs b/Cop.Borovkov.Var3/Lab3.Database/MappingProfiles/SessionMappingProfile.cs
new file mode 100644
index 0000000..251c789
--- /dev/null
+++ b/Cop.Borovkov.Var3/Lab3.Database/MappingProfiles/SessionMappingProfile.cs
@@ -0,0 +1,15 @@
+using AutoMapper;
+using Lab3.Database.DTO;
+using Lab3.Database.Models;
+
+namespace Lab3.Database.MappingProfiles
+{
+ public class SessionMappingProfile : Profile
+ {
+ SessionMappingProfile()
+ {
+ _ = CreateMap();
+ _ = CreateMap();
+ }
+ }
+}
diff --git a/Cop.Borovkov.Var3/Lab3.Database/MappingProfiles/StudentMappingProfile.cs b/Cop.Borovkov.Var3/Lab3.Database/MappingProfiles/StudentMappingProfile.cs
new file mode 100644
index 0000000..90f4673
--- /dev/null
+++ b/Cop.Borovkov.Var3/Lab3.Database/MappingProfiles/StudentMappingProfile.cs
@@ -0,0 +1,15 @@
+using AutoMapper;
+using Lab3.Database.DTO;
+using Lab3.Database.Models;
+
+namespace Lab3.Database.MappingProfiles
+{
+ public class StudentMappingProfile : Profile
+ {
+ public StudentMappingProfile()
+ {
+ _ = CreateMap();
+ _ = CreateMap();
+ }
+ }
+}
diff --git a/Cop.Borovkov.Var3/Lab3.Database/Models/EducationForm.cs b/Cop.Borovkov.Var3/Lab3.Database/Models/EducationForm.cs
new file mode 100644
index 0000000..41085df
--- /dev/null
+++ b/Cop.Borovkov.Var3/Lab3.Database/Models/EducationForm.cs
@@ -0,0 +1,13 @@
+// This file has been auto generated by EF Core Power Tools.
+#nullable disable
+using System;
+using System.Collections.Generic;
+
+namespace Lab3.Database.Models;
+
+public partial class EducationForm
+{
+ public Guid Id { get; set; }
+
+ public string Name { get; set; }
+}
\ No newline at end of file
diff --git a/Cop.Borovkov.Var3/Lab3.Database/Models/Student.cs b/Cop.Borovkov.Var3/Lab3.Database/Models/Student.cs
new file mode 100644
index 0000000..7057aa9
--- /dev/null
+++ b/Cop.Borovkov.Var3/Lab3.Database/Models/Student.cs
@@ -0,0 +1,19 @@
+// This file has been auto generated by EF Core Power Tools.
+#nullable disable
+using System;
+using System.Collections.Generic;
+
+namespace Lab3.Database.Models;
+
+public partial class Student
+{
+ public Guid Id { get; set; }
+
+ public string Name { get; set; }
+
+ public DateTime StartEducation { get; set; }
+
+ public string EducationForm { get; set; }
+
+ public virtual ICollection StudentSessions { get; set; } = new List();
+}
\ No newline at end of file
diff --git a/Cop.Borovkov.Var3/Lab3.Database/Models/StudentSession.cs b/Cop.Borovkov.Var3/Lab3.Database/Models/StudentSession.cs
new file mode 100644
index 0000000..575234e
--- /dev/null
+++ b/Cop.Borovkov.Var3/Lab3.Database/Models/StudentSession.cs
@@ -0,0 +1,19 @@
+// This file has been auto generated by EF Core Power Tools.
+#nullable disable
+using System;
+using System.Collections.Generic;
+
+namespace Lab3.Database.Models;
+
+public partial class StudentSession
+{
+ public Guid Id { get; set; }
+
+ public Guid StudentId { get; set; }
+
+ public decimal Score { get; set; }
+
+ public int Number { get; set; }
+
+ public virtual Student Student { get; set; }
+}
\ No newline at end of file
diff --git a/Cop.Borovkov.Var3/Lab3.Database/Repository/Interfaces/IStudentRepository.cs b/Cop.Borovkov.Var3/Lab3.Database/Repository/Interfaces/IStudentRepository.cs
new file mode 100644
index 0000000..968ded3
--- /dev/null
+++ b/Cop.Borovkov.Var3/Lab3.Database/Repository/Interfaces/IStudentRepository.cs
@@ -0,0 +1,17 @@
+using Lab3.Database.DTO;
+
+namespace Lab3.Database.Repository.Interfaces
+{
+ public interface IStudentRepository
+ {
+ public Task> Get(int limit = 10000, int offset = 0);
+
+ public Task Get(Guid id);
+
+ public Task Update(StudentDTO studentDTO);
+
+ public Task Delete(Guid id);
+
+ public Task> Create(StudentDTO studentDTO);
+ }
+}
diff --git a/Cop.Borovkov.Var3/Lab3.Database/efpt.config.json b/Cop.Borovkov.Var3/Lab3.Database/efpt.config.json
new file mode 100644
index 0000000..3d575bd
--- /dev/null
+++ b/Cop.Borovkov.Var3/Lab3.Database/efpt.config.json
@@ -0,0 +1,54 @@
+{
+ "CodeGenerationMode": 4,
+ "ContextClassName": "COPContext",
+ "ContextNamespace": "Context",
+ "FilterSchemas": false,
+ "IncludeConnectionString": false,
+ "ModelNamespace": "Models",
+ "OutputContextPath": "Context",
+ "OutputPath": "Models",
+ "PreserveCasingWithRegex": true,
+ "ProjectRootNamespace": "Lab3.Database",
+ "Schemas": null,
+ "SelectedHandlebarsLanguage": 2,
+ "SelectedToBeGenerated": 0,
+ "T4TemplatePath": null,
+ "Tables": [
+ {
+ "Name": "public.EducationForm",
+ "ObjectType": 0
+ },
+ {
+ "Name": "public.Student",
+ "ObjectType": 0
+ },
+ {
+ "Name": "public.StudentSession",
+ "ObjectType": 0
+ }
+ ],
+ "UiHint": null,
+ "UncountableWords": null,
+ "UseAsyncStoredProcedureCalls": true,
+ "UseBoolPropertiesWithoutDefaultSql": false,
+ "UseDatabaseNames": false,
+ "UseDateOnlyTimeOnly": true,
+ "UseDbContextSplitting": true,
+ "UseDecimalDataAnnotationForSprocResult": true,
+ "UseFluentApiOnly": true,
+ "UseHandleBars": false,
+ "UseHierarchyId": false,
+ "UseInflector": true,
+ "UseLegacyPluralizer": false,
+ "UseManyToManyEntity": false,
+ "UseNoDefaultConstructor": true,
+ "UseNoNavigations": false,
+ "UseNoObjectFilter": true,
+ "UseNodaTime": false,
+ "UseNullableReferences": false,
+ "UsePrefixNavigationNaming": false,
+ "UseSchemaFolders": false,
+ "UseSchemaNamespaces": false,
+ "UseSpatial": false,
+ "UseT4": false
+}
\ No newline at end of file
diff --git a/Cop.Borovkov.Var3/Lab3/Extensions/DIExtension.cs b/Cop.Borovkov.Var3/Lab3/Extensions/DIExtension.cs
new file mode 100644
index 0000000..8d3ade7
--- /dev/null
+++ b/Cop.Borovkov.Var3/Lab3/Extensions/DIExtension.cs
@@ -0,0 +1,19 @@
+using Lab3.Database.Extensions;
+using Microsoft.Extensions.Configuration;
+using Microsoft.Extensions.DependencyInjection;
+
+namespace Lab3.Extensions
+{
+ public static class DIExtension
+ {
+ public static IServiceCollection ConfigureDAL(
+ this IServiceCollection services,
+ IConfiguration configuration)
+ {
+ services.AddDatabase(configuration);
+ services.AddDbMapping();
+
+ return services;
+ }
+ }
+}
diff --git a/Cop.Borovkov.Var3/Lab3/Forms/MainForm.Designer.cs b/Cop.Borovkov.Var3/Lab3/Forms/MainForm.Designer.cs
new file mode 100644
index 0000000..1675ede
--- /dev/null
+++ b/Cop.Borovkov.Var3/Lab3/Forms/MainForm.Designer.cs
@@ -0,0 +1,39 @@
+namespace Lab3.Forms
+{
+ partial class MainForm
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.components = new System.ComponentModel.Container();
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(800, 450);
+ this.Text = "MainForm";
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/Cop.Borovkov.Var3/Lab3/Forms/MainForm.cs b/Cop.Borovkov.Var3/Lab3/Forms/MainForm.cs
new file mode 100644
index 0000000..7f63187
--- /dev/null
+++ b/Cop.Borovkov.Var3/Lab3/Forms/MainForm.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace Lab3.Forms
+{
+ public partial class MainForm : Form
+ {
+ public MainForm()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/Cop.Borovkov.Var3/Lab3/Forms/MainForm.resx b/Cop.Borovkov.Var3/Lab3/Forms/MainForm.resx
new file mode 100644
index 0000000..1af7de1
--- /dev/null
+++ b/Cop.Borovkov.Var3/Lab3/Forms/MainForm.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/Cop.Borovkov.Var3/Lab3/Lab3.csproj b/Cop.Borovkov.Var3/Lab3/Lab3.csproj
new file mode 100644
index 0000000..c1f50c7
--- /dev/null
+++ b/Cop.Borovkov.Var3/Lab3/Lab3.csproj
@@ -0,0 +1,19 @@
+
+
+
+ WinExe
+ net8.0-windows
+ enable
+ true
+ enable
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Cop.Borovkov.Var3/Lab3/MappingProfiles/StudentViewMappingProfile.cs b/Cop.Borovkov.Var3/Lab3/MappingProfiles/StudentViewMappingProfile.cs
new file mode 100644
index 0000000..1df0214
--- /dev/null
+++ b/Cop.Borovkov.Var3/Lab3/MappingProfiles/StudentViewMappingProfile.cs
@@ -0,0 +1,15 @@
+using AutoMapper;
+using Lab3.Database.DTO;
+using Lab3.Models;
+
+namespace Lab3.MappingProfiles
+{
+ public class StudentViewMappingProfile : Profile
+ {
+ public StudentViewMappingProfile()
+ {
+ _ = CreateMap()\
+ ;
+ }
+ }
+}
diff --git a/Cop.Borovkov.Var3/Lab3/Models/StudentViewModel.cs b/Cop.Borovkov.Var3/Lab3/Models/StudentViewModel.cs
new file mode 100644
index 0000000..54e9145
--- /dev/null
+++ b/Cop.Borovkov.Var3/Lab3/Models/StudentViewModel.cs
@@ -0,0 +1,15 @@
+using Lab3.Database.DTO;
+using System.Globalization;
+
+namespace Lab3.Models
+{
+ public record StudentViewModel : StudentDTO
+ {
+ public string SessionMarks => string.Join("; ", StudentSessions
+ .Select(s => string.Format(
+ CultureInfo.InvariantCulture,
+ "сессия{}: {0:f2}",
+ s.Number,
+ s.Score)));
+ }
+}
diff --git a/Cop.Borovkov.Var3/Lab3/Program.cs b/Cop.Borovkov.Var3/Lab3/Program.cs
new file mode 100644
index 0000000..f7a9a87
--- /dev/null
+++ b/Cop.Borovkov.Var3/Lab3/Program.cs
@@ -0,0 +1,17 @@
+namespace Lab3
+{
+ internal static class Program
+ {
+ ///
+ /// The main entry point for the application.
+ ///
+ [STAThread]
+ static void Main()
+ {
+ // To customize application configuration such as set high DPI settings or default font,
+ // see https://aka.ms/applicationconfiguration.
+ ApplicationConfiguration.Initialize();
+ Application.Run(new Form1());
+ }
+ }
+}
\ No newline at end of file
diff --git a/Cop.Borovkov.Var3/Lab3/appsettings.json b/Cop.Borovkov.Var3/Lab3/appsettings.json
new file mode 100644
index 0000000..751a2b0
--- /dev/null
+++ b/Cop.Borovkov.Var3/Lab3/appsettings.json
@@ -0,0 +1,5 @@
+{
+ "ConnectionStrings": {
+ "COPDataBase": "Host=localhost;Username=postgres;Password=postgres;Database=COP"
+ }
+}