diff --git a/WinFormsProject/AppView/AppView.csproj b/WinFormsProject/AppView/AppView.csproj
new file mode 100644
index 0000000..b85039e
--- /dev/null
+++ b/WinFormsProject/AppView/AppView.csproj
@@ -0,0 +1,22 @@
+
+
+
+ WinExe
+ net6.0-windows
+ enable
+ true
+ enable
+
+
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/WinFormsProject/AppView/Form1.Designer.cs b/WinFormsProject/AppView/Form1.Designer.cs
new file mode 100644
index 0000000..1b9a8ab
--- /dev/null
+++ b/WinFormsProject/AppView/Form1.Designer.cs
@@ -0,0 +1,39 @@
+namespace AppView
+{
+ partial class Form1
+ {
+ ///
+ /// 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 = "Form1";
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/WinFormsProject/AppView/Form1.cs b/WinFormsProject/AppView/Form1.cs
new file mode 100644
index 0000000..c023e9d
--- /dev/null
+++ b/WinFormsProject/AppView/Form1.cs
@@ -0,0 +1,10 @@
+namespace AppView
+{
+ public partial class Form1 : Form
+ {
+ public Form1()
+ {
+ InitializeComponent();
+ }
+ }
+}
\ No newline at end of file
diff --git a/WinFormsProject/AppView/Form1.resx b/WinFormsProject/AppView/Form1.resx
new file mode 100644
index 0000000..1af7de1
--- /dev/null
+++ b/WinFormsProject/AppView/Form1.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/WinFormsProject/AppView/Program.cs b/WinFormsProject/AppView/Program.cs
new file mode 100644
index 0000000..5561de2
--- /dev/null
+++ b/WinFormsProject/AppView/Program.cs
@@ -0,0 +1,17 @@
+namespace AppView
+{
+ 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/WinFormsProject/Contracts/BindingModels/ProviderBindingModel.cs b/WinFormsProject/Contracts/BindingModels/ProviderBindingModel.cs
new file mode 100644
index 0000000..37e4e07
--- /dev/null
+++ b/WinFormsProject/Contracts/BindingModels/ProviderBindingModel.cs
@@ -0,0 +1,26 @@
+using DataModels.Models;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Contracts.BindingModels
+{
+ public class ProviderBindingModel : IProviderModel
+ {
+ public string Name { get; set; }
+ public string Type { get; set; }
+ public byte[] Logo { get; set; }
+ public string Number { get; set; }
+
+ public int Id { get; set; }
+
+ public ProviderBindingModel() { }
+
+ public ProviderBindingModel(IProviderModel provider)
+ {
+ Id = provider.Id;
+ }
+ }
+}
diff --git a/WinFormsProject/Contracts/BindingModels/TypeBindingModel.cs b/WinFormsProject/Contracts/BindingModels/TypeBindingModel.cs
new file mode 100644
index 0000000..2f90efe
--- /dev/null
+++ b/WinFormsProject/Contracts/BindingModels/TypeBindingModel.cs
@@ -0,0 +1,22 @@
+using DataModels.Models;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Contracts.BindingModels
+{
+ public class TypeBindingModel : ITypeModel
+ {
+ public string Name { get; set; }
+ public int Id { get; set; }
+
+ public TypeBindingModel() { }
+
+ public TypeBindingModel(ITypeModel type)
+ {
+ Id = type.Id;
+ }
+ }
+}
diff --git a/WinFormsProject/Contracts/Contracts.csproj b/WinFormsProject/Contracts/Contracts.csproj
new file mode 100644
index 0000000..0201c16
--- /dev/null
+++ b/WinFormsProject/Contracts/Contracts.csproj
@@ -0,0 +1,13 @@
+
+
+
+ net6.0
+ enable
+ enable
+
+
+
+
+
+
+
diff --git a/WinFormsProject/Contracts/SearchModels/ProviderSearchModel.cs b/WinFormsProject/Contracts/SearchModels/ProviderSearchModel.cs
new file mode 100644
index 0000000..993d701
--- /dev/null
+++ b/WinFormsProject/Contracts/SearchModels/ProviderSearchModel.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Contracts.SearchModels
+{
+ public class ProviderSearchModel
+ {
+ public int? Id { get; set; }
+ }
+}
diff --git a/WinFormsProject/Contracts/SearchModels/TypeSearchModel.cs b/WinFormsProject/Contracts/SearchModels/TypeSearchModel.cs
new file mode 100644
index 0000000..825496a
--- /dev/null
+++ b/WinFormsProject/Contracts/SearchModels/TypeSearchModel.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Contracts.SearchModels
+{
+ public class TypeSearchModel
+ {
+ public int? Id { get; set; }
+ }
+}
diff --git a/WinFormsProject/Contracts/StorageContracts/IProviderStorage.cs b/WinFormsProject/Contracts/StorageContracts/IProviderStorage.cs
new file mode 100644
index 0000000..c6367ad
--- /dev/null
+++ b/WinFormsProject/Contracts/StorageContracts/IProviderStorage.cs
@@ -0,0 +1,21 @@
+using Contracts.BindingModels;
+using Contracts.SearchModels;
+using Contracts.ViewModels;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Contracts.StorageContracts
+{
+ public interface IProviderStorage
+ {
+ List GetFullList();
+ ProviderViewModel? GetElement(ProviderSearchModel model);
+ List GetFilteredList(ProviderSearchModel model);
+ ProviderViewModel? Insert(ProviderBindingModel model);
+ ProviderViewModel? Update(ProviderBindingModel model);
+ ProviderViewModel? Delete(ProviderBindingModel model);
+ }
+}
diff --git a/WinFormsProject/Contracts/StorageContracts/ITypeStorage.cs b/WinFormsProject/Contracts/StorageContracts/ITypeStorage.cs
new file mode 100644
index 0000000..22fe115
--- /dev/null
+++ b/WinFormsProject/Contracts/StorageContracts/ITypeStorage.cs
@@ -0,0 +1,20 @@
+using Contracts.BindingModels;
+using Contracts.SearchModels;
+using Contracts.ViewModels;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Contracts.StorageContracts
+{
+ public interface ITypeStorage
+ {
+ List GetFullList();
+ TypeViewModel? GetElement(TypeSearchModel model);
+ TypeViewModel? Insert(TypeBindingModel model);
+ TypeViewModel? Update(TypeBindingModel model);
+ TypeViewModel? Delete(TypeBindingModel model);
+ }
+}
diff --git a/WinFormsProject/Contracts/ViewModels/ProviderViewModel.cs b/WinFormsProject/Contracts/ViewModels/ProviderViewModel.cs
new file mode 100644
index 0000000..0512b0f
--- /dev/null
+++ b/WinFormsProject/Contracts/ViewModels/ProviderViewModel.cs
@@ -0,0 +1,18 @@
+using DataModels.Models;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Contracts.ViewModels
+{
+ public class ProviderViewModel : IProviderModel
+ {
+ public string Name { get; set; }
+ public string Type { get; set; }
+ public byte[] Logo { get; set; }
+ public string Number { get; set; }
+ public int Id { get; set; }
+ }
+}
diff --git a/WinFormsProject/Contracts/ViewModels/TypeViewModel.cs b/WinFormsProject/Contracts/ViewModels/TypeViewModel.cs
new file mode 100644
index 0000000..7ede071
--- /dev/null
+++ b/WinFormsProject/Contracts/ViewModels/TypeViewModel.cs
@@ -0,0 +1,15 @@
+using DataModels.Models;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Contracts.ViewModels
+{
+ public class TypeViewModel : ITypeModel
+ {
+ public string Name { get; set; }
+ public int Id { get; set; }
+ }
+}
diff --git a/WinFormsProject/DataModels/DataModels.csproj b/WinFormsProject/DataModels/DataModels.csproj
new file mode 100644
index 0000000..132c02c
--- /dev/null
+++ b/WinFormsProject/DataModels/DataModels.csproj
@@ -0,0 +1,9 @@
+
+
+
+ net6.0
+ enable
+ enable
+
+
+
diff --git a/WinFormsProject/DataModels/IId.cs b/WinFormsProject/DataModels/IId.cs
new file mode 100644
index 0000000..dd022c4
--- /dev/null
+++ b/WinFormsProject/DataModels/IId.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DataModels
+{
+ public interface IId
+ {
+ int Id { get; }
+ }
+}
diff --git a/WinFormsProject/DataModels/Models/IProviderModel.cs b/WinFormsProject/DataModels/Models/IProviderModel.cs
new file mode 100644
index 0000000..155769b
--- /dev/null
+++ b/WinFormsProject/DataModels/Models/IProviderModel.cs
@@ -0,0 +1,16 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DataModels.Models
+{
+ public interface IProviderModel : IId
+ {
+ string Name { get; set; }
+ string Type { get; set; }
+ byte[] Logo { get; set; }
+ string Number { get; set; }
+ }
+}
diff --git a/WinFormsProject/DataModels/Models/ITypeModel.cs b/WinFormsProject/DataModels/Models/ITypeModel.cs
new file mode 100644
index 0000000..4f208ce
--- /dev/null
+++ b/WinFormsProject/DataModels/Models/ITypeModel.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DataModels.Models
+{
+ public interface ITypeModel : IId
+ {
+ string Name { get; set; }
+ }
+}
diff --git a/WinFormsProject/DateBaseImplement/DBContext.cs b/WinFormsProject/DateBaseImplement/DBContext.cs
new file mode 100644
index 0000000..f3d8c73
--- /dev/null
+++ b/WinFormsProject/DateBaseImplement/DBContext.cs
@@ -0,0 +1,24 @@
+using DateBaseImplement.Models;
+using Microsoft.EntityFrameworkCore;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DateBaseImplement
+{
+ public class DBContext : DbContext
+ {
+ protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
+ {
+ if (!optionsBuilder.IsConfigured)
+ optionsBuilder.UseNpgsql(@"Host=localhost;Port=5432;Database=COP;Username=postgres;Password=postgres");
+ base.OnConfiguring(optionsBuilder);
+ }
+
+ public virtual DbSet Providers { get; set; }
+ public virtual DbSet Types { get; set; }
+ }
+}
diff --git a/WinFormsProject/DateBaseImplement/DateBaseImplement.csproj b/WinFormsProject/DateBaseImplement/DateBaseImplement.csproj
new file mode 100644
index 0000000..2bbe139
--- /dev/null
+++ b/WinFormsProject/DateBaseImplement/DateBaseImplement.csproj
@@ -0,0 +1,22 @@
+
+
+
+ net6.0
+ enable
+ enable
+
+
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
+
+
+
+
+
+
+
+
diff --git a/WinFormsProject/DateBaseImplement/Implements/ProviderStorage.cs b/WinFormsProject/DateBaseImplement/Implements/ProviderStorage.cs
new file mode 100644
index 0000000..cae171d
--- /dev/null
+++ b/WinFormsProject/DateBaseImplement/Implements/ProviderStorage.cs
@@ -0,0 +1,73 @@
+using Contracts.BindingModels;
+using Contracts.SearchModels;
+using Contracts.StorageContracts;
+using Contracts.ViewModels;
+using DateBaseImplement.Models;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DateBaseImplement.Implements
+{
+ public class ProviderStorage : IProviderStorage
+ {
+ public ProviderViewModel? Insert(ProviderBindingModel model)
+ {
+ var newProvider = Provider.Create(model);
+ if (newProvider == null) return null;
+
+ using var context = new DBContext();
+ context.Providers.Add(newProvider);
+ context.SaveChanges();
+ return newProvider.GetViewModel;
+ }
+
+ public ProviderViewModel? Update(ProviderBindingModel model)
+ {
+ using var context = new DBContext();
+ var provider = context.Providers.FirstOrDefault(x => x.Id == model.Id);
+ if (provider == null) return null;
+ provider.Update(model);
+ context.SaveChanges();
+ return provider.GetViewModel;
+ }
+
+ public ProviderViewModel? Delete(ProviderBindingModel model)
+ {
+ using var context = new DBContext();
+ var element = context.Providers.FirstOrDefault(x => x.Id == model.Id);
+ if (element == null) return null;
+ context.Providers.Remove(element);
+ context.SaveChanges();
+ return element.GetViewModel;
+ }
+
+ public ProviderViewModel? GetElement(ProviderSearchModel model)
+ {
+ if (!model.Id.HasValue) return null;
+ using var context = new DBContext();
+ return context.Providers
+ .FirstOrDefault(x => model.Id.HasValue && x.Id == model.Id)?
+ .GetViewModel;
+ }
+
+ public List GetFullList()
+ {
+ using var context = new DBContext();
+ return context.Providers
+ .Select(x => x.GetViewModel)
+ .ToList();
+ }
+
+ public List GetFilteredList(ProviderSearchModel model)
+ {
+ using var context = new DBContext();
+ return context.Providers
+ .Where(x => model.Id.HasValue && x.Id == model.Id)
+ .Select(x => x.GetViewModel)
+ .ToList();
+ }
+ }
+}
diff --git a/WinFormsProject/DateBaseImplement/Implements/TypeStorage.cs b/WinFormsProject/DateBaseImplement/Implements/TypeStorage.cs
new file mode 100644
index 0000000..2c12541
--- /dev/null
+++ b/WinFormsProject/DateBaseImplement/Implements/TypeStorage.cs
@@ -0,0 +1,62 @@
+using Contracts.BindingModels;
+using Contracts.SearchModels;
+using Contracts.StorageContracts;
+using Contracts.ViewModels;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DateBaseImplement.Implements
+{
+ public class TypeStorage : ITypeStorage
+ {
+ public TypeViewModel? Insert(TypeBindingModel model)
+ {
+ var newType = Models.Type.Create(model);
+ if (newType == null) return null;
+ using var context = new DBContext();
+ context.Types.Add(newType);
+ context.SaveChanges();
+ return newType.GetViewModel;
+ }
+
+ public TypeViewModel? Update(TypeBindingModel model)
+ {
+ using var context = new DBContext();
+ var type = context.Types.FirstOrDefault(x => x.Id == model.Id);
+ if (type == null) return null;
+ type.Update(model);
+ context.SaveChanges();
+ return type.GetViewModel;
+ }
+
+ public TypeViewModel? Delete(TypeBindingModel model)
+ {
+ using var context = new DBContext();
+ var type = context.Types.FirstOrDefault(x => x.Id == model.Id);
+ if (type == null) return null;
+ context.Types.Remove(type);
+ context.SaveChanges();
+ return type.GetViewModel;
+ }
+
+ public TypeViewModel? GetElement(TypeSearchModel model)
+ {
+ if (!model.Id.HasValue) return null;
+ using var context = new DBContext();
+ return context.Types
+ .FirstOrDefault(x => model.Id.HasValue && x.Id == model.Id)
+ ?.GetViewModel;
+ }
+
+ public List GetFullList()
+ {
+ using var context = new DBContext();
+ return context.Types
+ .Select(x => x.GetViewModel)
+ .ToList();
+ }
+ }
+}
diff --git a/WinFormsProject/DateBaseImplement/Migrations/20231115184705_initMigration.Designer.cs b/WinFormsProject/DateBaseImplement/Migrations/20231115184705_initMigration.Designer.cs
new file mode 100644
index 0000000..072c182
--- /dev/null
+++ b/WinFormsProject/DateBaseImplement/Migrations/20231115184705_initMigration.Designer.cs
@@ -0,0 +1,75 @@
+//
+using DateBaseImplement;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
+
+#nullable disable
+
+namespace DateBaseImplement.Migrations
+{
+ [DbContext(typeof(DBContext))]
+ [Migration("20231115184705_initMigration")]
+ partial class initMigration
+ {
+ ///
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "7.0.14")
+ .HasAnnotation("Relational:MaxIdentifierLength", 63);
+
+ NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
+
+ modelBuilder.Entity("DateBaseImplement.Models.Provider", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("Logo")
+ .IsRequired()
+ .HasColumnType("bytea");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("Number")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("Type")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.HasKey("Id");
+
+ b.ToTable("Providers");
+ });
+
+ modelBuilder.Entity("DateBaseImplement.Models.Type", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.HasKey("Id");
+
+ b.ToTable("Types");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/WinFormsProject/DateBaseImplement/Migrations/20231115184705_initMigration.cs b/WinFormsProject/DateBaseImplement/Migrations/20231115184705_initMigration.cs
new file mode 100644
index 0000000..25b26af
--- /dev/null
+++ b/WinFormsProject/DateBaseImplement/Migrations/20231115184705_initMigration.cs
@@ -0,0 +1,54 @@
+using Microsoft.EntityFrameworkCore.Migrations;
+using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
+
+#nullable disable
+
+namespace DateBaseImplement.Migrations
+{
+ ///
+ public partial class initMigration : Migration
+ {
+ ///
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.CreateTable(
+ name: "Providers",
+ columns: table => new
+ {
+ Id = table.Column(type: "integer", nullable: false)
+ .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
+ Name = table.Column(type: "text", nullable: false),
+ Logo = table.Column(type: "bytea", nullable: false),
+ Type = table.Column(type: "text", nullable: false),
+ Number = table.Column(type: "text", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Providers", x => x.Id);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "Types",
+ 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_Types", x => x.Id);
+ });
+ }
+
+ ///
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropTable(
+ name: "Providers");
+
+ migrationBuilder.DropTable(
+ name: "Types");
+ }
+ }
+}
diff --git a/WinFormsProject/DateBaseImplement/Migrations/DBContextModelSnapshot.cs b/WinFormsProject/DateBaseImplement/Migrations/DBContextModelSnapshot.cs
new file mode 100644
index 0000000..43ccabe
--- /dev/null
+++ b/WinFormsProject/DateBaseImplement/Migrations/DBContextModelSnapshot.cs
@@ -0,0 +1,72 @@
+//
+using DateBaseImplement;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
+
+#nullable disable
+
+namespace DateBaseImplement.Migrations
+{
+ [DbContext(typeof(DBContext))]
+ partial class DBContextModelSnapshot : ModelSnapshot
+ {
+ protected override void BuildModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "7.0.14")
+ .HasAnnotation("Relational:MaxIdentifierLength", 63);
+
+ NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
+
+ modelBuilder.Entity("DateBaseImplement.Models.Provider", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("Logo")
+ .IsRequired()
+ .HasColumnType("bytea");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("Number")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("Type")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.HasKey("Id");
+
+ b.ToTable("Providers");
+ });
+
+ modelBuilder.Entity("DateBaseImplement.Models.Type", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.HasKey("Id");
+
+ b.ToTable("Types");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/WinFormsProject/DateBaseImplement/Models/Provider.cs b/WinFormsProject/DateBaseImplement/Models/Provider.cs
new file mode 100644
index 0000000..a5b8fcf
--- /dev/null
+++ b/WinFormsProject/DateBaseImplement/Models/Provider.cs
@@ -0,0 +1,62 @@
+using Contracts.BindingModels;
+using Contracts.ViewModels;
+using DataModels.Models;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DateBaseImplement.Models
+{
+ public class Provider : IProviderModel
+ {
+ public int Id { get; set; }
+
+ [Required]
+ public string Name { get; set; }
+
+ [Required]
+ public byte[] Logo { get; set; }
+
+ [Required]
+ public string Type { get; set; }
+
+ [Required]
+ public string Number { get; set; }
+
+ public static Provider? Create(ProviderBindingModel model)
+ {
+ if (model == null) return null;
+
+ return new Provider()
+ {
+ Id = model.Id,
+ Name = model.Name,
+ Type = model.Type,
+ Logo = model.Logo,
+ Number = model.Number,
+ };
+ }
+
+ public void Update(ProviderBindingModel model)
+ {
+ if (model == null) return;
+
+ Name = model.Name;
+ Type = model.Type;
+ Logo = model.Logo;
+ Number = model.Number;
+ }
+
+ public ProviderViewModel GetViewModel => new()
+ {
+ Id = Id,
+ Name = Name,
+ Type = Type,
+ Logo = Logo,
+ Number = Number,
+ };
+ }
+}
diff --git a/WinFormsProject/DateBaseImplement/Models/Type.cs b/WinFormsProject/DateBaseImplement/Models/Type.cs
new file mode 100644
index 0000000..62d4db3
--- /dev/null
+++ b/WinFormsProject/DateBaseImplement/Models/Type.cs
@@ -0,0 +1,42 @@
+using Contracts.BindingModels;
+using Contracts.ViewModels;
+using DataModels.Models;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.Linq;
+using System.Linq.Expressions;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DateBaseImplement.Models
+{
+ public class Type : ITypeModel
+ {
+ public int Id { get; set; }
+ [Required]
+ public string Name { get; set; }
+
+ public static Type? Create(TypeBindingModel model)
+ {
+ if (model == null) return null;
+
+ return new Type()
+ {
+ Name = model.Name,
+ };
+ }
+
+ public void Update(TypeBindingModel model)
+ {
+ if (model == null) return;
+ model.Name = Name;
+ }
+
+ public TypeViewModel GetViewModel => new()
+ {
+ Id = Id,
+ Name = Name,
+ };
+ }
+}
diff --git a/WinFormsProject/WinFormsProject.sln b/WinFormsProject/WinFormsProject.sln
index de4a0d7..ebeb726 100644
--- a/WinFormsProject/WinFormsProject.sln
+++ b/WinFormsProject/WinFormsProject.sln
@@ -3,9 +3,17 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.3.32819.101
MinimumVisualStudioVersion = 10.0.40219.1
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WinFormsProject", "WinFormsProject\WinFormsProject.csproj", "{1FC6ABE3-DF27-453A-B2EE-FA17C71C9CF0}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WinFormsProject", "WinFormsProject\WinFormsProject.csproj", "{1FC6ABE3-DF27-453A-B2EE-FA17C71C9CF0}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WinFormsLibrary", "WinFormsLibrary\WinFormsLibrary.csproj", "{CF6B5601-DC60-48A2-8BDC-1CE32E3F6F15}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WinFormsLibrary", "WinFormsLibrary\WinFormsLibrary.csproj", "{CF6B5601-DC60-48A2-8BDC-1CE32E3F6F15}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DataModels", "DataModels\DataModels.csproj", "{23F0E442-0283-4192-A17B-D13D0C01C10D}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Contracts", "Contracts\Contracts.csproj", "{6A196E6B-91D9-4873-9E5F-0D96D18A74F5}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DateBaseImplement", "DateBaseImplement\DateBaseImplement.csproj", "{F53D2EB4-F1EB-4C24-987C-CCC6BFC5FAD7}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppView", "AppView\AppView.csproj", "{294B81DD-546F-40AD-9BCE-0F51F1D17D1A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -21,6 +29,22 @@ Global
{CF6B5601-DC60-48A2-8BDC-1CE32E3F6F15}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CF6B5601-DC60-48A2-8BDC-1CE32E3F6F15}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CF6B5601-DC60-48A2-8BDC-1CE32E3F6F15}.Release|Any CPU.Build.0 = Release|Any CPU
+ {23F0E442-0283-4192-A17B-D13D0C01C10D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {23F0E442-0283-4192-A17B-D13D0C01C10D}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {23F0E442-0283-4192-A17B-D13D0C01C10D}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {23F0E442-0283-4192-A17B-D13D0C01C10D}.Release|Any CPU.Build.0 = Release|Any CPU
+ {6A196E6B-91D9-4873-9E5F-0D96D18A74F5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {6A196E6B-91D9-4873-9E5F-0D96D18A74F5}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {6A196E6B-91D9-4873-9E5F-0D96D18A74F5}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {6A196E6B-91D9-4873-9E5F-0D96D18A74F5}.Release|Any CPU.Build.0 = Release|Any CPU
+ {F53D2EB4-F1EB-4C24-987C-CCC6BFC5FAD7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {F53D2EB4-F1EB-4C24-987C-CCC6BFC5FAD7}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {F53D2EB4-F1EB-4C24-987C-CCC6BFC5FAD7}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {F53D2EB4-F1EB-4C24-987C-CCC6BFC5FAD7}.Release|Any CPU.Build.0 = Release|Any CPU
+ {294B81DD-546F-40AD-9BCE-0F51F1D17D1A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {294B81DD-546F-40AD-9BCE-0F51F1D17D1A}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {294B81DD-546F-40AD-9BCE-0F51F1D17D1A}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {294B81DD-546F-40AD-9BCE-0F51F1D17D1A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE