Исправление БД для работы с фреймворком. Это треш.

This commit is contained in:
Programmist73 2023-04-13 00:10:37 +04:00
parent 26e96f3294
commit 85109c5dc1
13 changed files with 922 additions and 2 deletions

View File

@ -7,9 +7,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TransportCompany", "Transpo
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TransportCompanyDataModels", "TransportCompanyDataModels\TransportCompanyDataModels.csproj", "{C57B4449-A725-4804-833D-7CE33965F001}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TransportCompanyContracts", "TransportCompanyContracts\TransportCompanyContracts.csproj", "{8707D719-D7B3-4F64-8BBE-DE9C7014DD13}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TransportCompanyContracts", "TransportCompanyContracts\TransportCompanyContracts.csproj", "{8707D719-D7B3-4F64-8BBE-DE9C7014DD13}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TransportCompanyBusinessLogic", "TransportCompanyBusinessLogic\TransportCompanyBusinessLogic.csproj", "{5FD7F1C8-0B2C-4AD4-91FD-A4475274FD3A}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TransportCompanyBusinessLogic", "TransportCompanyBusinessLogic\TransportCompanyBusinessLogic.csproj", "{5FD7F1C8-0B2C-4AD4-91FD-A4475274FD3A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TransportCompanyDatabaseImplements", "TransportCompanyDatabaseImplements\TransportCompanyDatabaseImplements.csproj", "{E421890B-5501-4A4D-931A-1B8139FDDB24}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -33,6 +35,10 @@ Global
{5FD7F1C8-0B2C-4AD4-91FD-A4475274FD3A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5FD7F1C8-0B2C-4AD4-91FD-A4475274FD3A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5FD7F1C8-0B2C-4AD4-91FD-A4475274FD3A}.Release|Any CPU.Build.0 = Release|Any CPU
{E421890B-5501-4A4D-931A-1B8139FDDB24}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E421890B-5501-4A4D-931A-1B8139FDDB24}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E421890B-5501-4A4D-931A-1B8139FDDB24}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E421890B-5501-4A4D-931A-1B8139FDDB24}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -8,4 +8,23 @@
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="7.0.3" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\TransportCompanyBusinessLogic\TransportCompanyBusinessLogic.csproj" />
<ProjectReference Include="..\TransportCompanyContracts\TransportCompanyContracts.csproj" />
<ProjectReference Include="..\TransportCompanyDatabaseImplements\TransportCompanyDatabaseImplements.csproj" />
<ProjectReference Include="..\TransportCompanyDataModels\TransportCompanyDataModels.csproj" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,150 @@
using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore;
using TransportCompanyDatabaseImplements.Models;
namespace TransportCompanyDatabaseImplements;
public partial class ElegevContext : DbContext
{
public ElegevContext()
{
}
public ElegevContext(DbContextOptions<ElegevContext> options)
: base(options)
{
}
public virtual DbSet<Cargo> Cargos { get; set; }
public virtual DbSet<Client> Clients { get; set; }
public virtual DbSet<Transport> Transports { get; set; }
public virtual DbSet<Trucking> Truckings { get; set; }
public virtual DbSet<TypeTransportation> TypeTransportations { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
#warning To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see http://go.microsoft.com/fwlink/?LinkId=723263.
=> optionsBuilder.UseNpgsql("Host=192.168.56.101;Port=6000;Database=elegev;Username=elegev;Password=user");
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<Cargo>(entity =>
{
entity.HasKey(e => e.Id).HasName("cargo_pkey");
entity.ToTable("cargo");
entity.Property(e => e.Id)
.ValueGeneratedNever()
.HasColumnName("id");
entity.Property(e => e.TypeCargo)
.HasMaxLength(255)
.HasColumnName("type_cargo");
});
modelBuilder.Entity<Client>(entity =>
{
entity.HasKey(e => e.Id).HasName("client_pkey");
entity.ToTable("client");
entity.Property(e => e.Id)
.ValueGeneratedNever()
.HasColumnName("id");
entity.Property(e => e.Email)
.HasMaxLength(255)
.HasColumnName("email");
entity.Property(e => e.Name)
.HasMaxLength(255)
.HasColumnName("name");
entity.Property(e => e.Patronymic)
.HasMaxLength(255)
.HasColumnName("patronymic");
entity.Property(e => e.Surname)
.HasMaxLength(255)
.HasColumnName("surname");
entity.Property(e => e.Telephone)
.HasMaxLength(255)
.HasColumnName("telephone");
});
modelBuilder.Entity<Transport>(entity =>
{
entity.HasKey(e => e.Id).HasName("transport_pkey");
entity.ToTable("transport");
entity.Property(e => e.Id)
.ValueGeneratedNever()
.HasColumnName("id");
entity.Property(e => e.TransportType)
.HasMaxLength(255)
.HasColumnName("transport_type");
});
modelBuilder.Entity<Trucking>(entity =>
{
entity.HasKey(e => e.Id).HasName("trucking_pkey");
entity.ToTable("trucking");
entity.Property(e => e.Id)
.ValueGeneratedNever()
.HasColumnName("id");
entity.Property(e => e.CargoId).HasColumnName("cargo_id");
entity.Property(e => e.ClientId).HasColumnName("client_id");
entity.Property(e => e.DateEnd).HasColumnName("date_end");
entity.Property(e => e.DateStart).HasColumnName("date_start");
entity.Property(e => e.Price).HasColumnName("price");
entity.Property(e => e.TransportId).HasColumnName("transport_id");
entity.Property(e => e.TypeTransportationId).HasColumnName("type_transportation_id");
entity.HasOne(d => d.Cargo).WithMany(p => p.Truckings)
.HasForeignKey(d => d.CargoId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("cargo_id");
entity.HasOne(d => d.Client).WithMany(p => p.Truckings)
.HasForeignKey(d => d.ClientId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("client_id");
entity.HasOne(d => d.Transport).WithMany(p => p.Truckings)
.HasForeignKey(d => d.TransportId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("transport_id");
entity.HasOne(d => d.TypeTransportation).WithMany(p => p.Truckings)
.HasForeignKey(d => d.TypeTransportationId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("type_transportation_id");
});
modelBuilder.Entity<TypeTransportation>(entity =>
{
entity.HasKey(e => e.Id).HasName("type_transportation_pkey");
entity.ToTable("type_transportation");
entity.Property(e => e.Id)
.ValueGeneratedNever()
.HasColumnName("id");
entity.Property(e => e.TransportationType)
.HasMaxLength(255)
.HasColumnName("transportation_type");
});
modelBuilder.HasSequence("seq_cargo");
modelBuilder.HasSequence("seq_client");
modelBuilder.HasSequence("seq_trucking");
modelBuilder.HasSequence("seq_type_transport");
modelBuilder.HasSequence("seq_type_transportation");
OnModelCreatingPartial(modelBuilder);
}
partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
}

View File

@ -0,0 +1,47 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TransportCompanyContracts.BindingModels;
using TransportCompanyContracts.SearchModels;
using TransportCompanyContracts.StoragesContracts;
using TransportCompanyContracts.ViewModels;
namespace TransportCompanyDatabaseImplements.Implements
{
public class ClientStorage : IClientStorage
{
public List<ClientViewModel> GetFullList()
{
using var context = new ElegevContext();
return context.Clients.ToList();
}
public List<ClientViewModel> GetFilteredList(ClientSearchModel model)
{
throw new NotImplementedException();
}
public ClientViewModel? GetElement(ClientSearchModel model)
{
throw new NotImplementedException();
}
public ClientViewModel? Insert(ClientBindingModel model)
{
throw new NotImplementedException();
}
public ClientViewModel? Update(ClientBindingModel model)
{
throw new NotImplementedException();
}
public ClientViewModel? Delete(ClientBindingModel model)
{
throw new NotImplementedException();
}
}
}

View File

@ -0,0 +1,239 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using TransportCompanyDatabaseImplements;
#nullable disable
namespace TransportCompanyDatabaseImplements.Migrations
{
[DbContext(typeof(ElegevContext))]
[Migration("20230412195202_StartMigration")]
partial class StartMigration
{
/// <inheritdoc />
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.HasSequence("seq_cargo");
modelBuilder.HasSequence("seq_client");
modelBuilder.HasSequence("seq_trucking");
modelBuilder.HasSequence("seq_type_transport");
modelBuilder.HasSequence("seq_type_transportation");
modelBuilder.Entity("TransportCompanyDatabaseImplements.Models.Cargo", b =>
{
b.Property<int>("Id")
.HasColumnType("integer")
.HasColumnName("id");
b.Property<string>("TypeCargo")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("character varying(255)")
.HasColumnName("type_cargo");
b.HasKey("Id")
.HasName("cargo_pkey");
b.ToTable("cargo", (string)null);
});
modelBuilder.Entity("TransportCompanyDatabaseImplements.Models.Client", b =>
{
b.Property<int>("Id")
.HasColumnType("integer")
.HasColumnName("id");
b.Property<string>("Email")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("character varying(255)")
.HasColumnName("email");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("character varying(255)")
.HasColumnName("name");
b.Property<string>("Patronymic")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("character varying(255)")
.HasColumnName("patronymic");
b.Property<string>("Surname")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("character varying(255)")
.HasColumnName("surname");
b.Property<string>("Telephone")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("character varying(255)")
.HasColumnName("telephone");
b.HasKey("Id")
.HasName("client_pkey");
b.ToTable("client", (string)null);
});
modelBuilder.Entity("TransportCompanyDatabaseImplements.Models.Transport", b =>
{
b.Property<int>("Id")
.HasColumnType("integer")
.HasColumnName("id");
b.Property<string>("TransportType")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("character varying(255)")
.HasColumnName("transport_type");
b.HasKey("Id")
.HasName("transport_pkey");
b.ToTable("transport", (string)null);
});
modelBuilder.Entity("TransportCompanyDatabaseImplements.Models.Trucking", b =>
{
b.Property<int>("Id")
.HasColumnType("integer")
.HasColumnName("id");
b.Property<int>("CargoId")
.HasColumnType("integer")
.HasColumnName("cargo_id");
b.Property<int>("ClientId")
.HasColumnType("integer")
.HasColumnName("client_id");
b.Property<DateOnly>("DateEnd")
.HasColumnType("date")
.HasColumnName("date_end");
b.Property<DateOnly>("DateStart")
.HasColumnType("date")
.HasColumnName("date_start");
b.Property<int>("Price")
.HasColumnType("integer")
.HasColumnName("price");
b.Property<int>("TransportId")
.HasColumnType("integer")
.HasColumnName("transport_id");
b.Property<int>("TypeTransportationId")
.HasColumnType("integer")
.HasColumnName("type_transportation_id");
b.HasKey("Id")
.HasName("trucking_pkey");
b.HasIndex("CargoId");
b.HasIndex("ClientId");
b.HasIndex("TransportId");
b.HasIndex("TypeTransportationId");
b.ToTable("trucking", (string)null);
});
modelBuilder.Entity("TransportCompanyDatabaseImplements.Models.TypeTransportation", b =>
{
b.Property<int>("Id")
.HasColumnType("integer")
.HasColumnName("id");
b.Property<string>("TransportationType")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("character varying(255)")
.HasColumnName("transportation_type");
b.HasKey("Id")
.HasName("type_transportation_pkey");
b.ToTable("type_transportation", (string)null);
});
modelBuilder.Entity("TransportCompanyDatabaseImplements.Models.Trucking", b =>
{
b.HasOne("TransportCompanyDatabaseImplements.Models.Cargo", "Cargo")
.WithMany("Truckings")
.HasForeignKey("CargoId")
.IsRequired()
.HasConstraintName("cargo_id");
b.HasOne("TransportCompanyDatabaseImplements.Models.Client", "Client")
.WithMany("Truckings")
.HasForeignKey("ClientId")
.IsRequired()
.HasConstraintName("client_id");
b.HasOne("TransportCompanyDatabaseImplements.Models.Transport", "Transport")
.WithMany("Truckings")
.HasForeignKey("TransportId")
.IsRequired()
.HasConstraintName("transport_id");
b.HasOne("TransportCompanyDatabaseImplements.Models.TypeTransportation", "TypeTransportation")
.WithMany("Truckings")
.HasForeignKey("TypeTransportationId")
.IsRequired()
.HasConstraintName("type_transportation_id");
b.Navigation("Cargo");
b.Navigation("Client");
b.Navigation("Transport");
b.Navigation("TypeTransportation");
});
modelBuilder.Entity("TransportCompanyDatabaseImplements.Models.Cargo", b =>
{
b.Navigation("Truckings");
});
modelBuilder.Entity("TransportCompanyDatabaseImplements.Models.Client", b =>
{
b.Navigation("Truckings");
});
modelBuilder.Entity("TransportCompanyDatabaseImplements.Models.Transport", b =>
{
b.Navigation("Truckings");
});
modelBuilder.Entity("TransportCompanyDatabaseImplements.Models.TypeTransportation", b =>
{
b.Navigation("Truckings");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -0,0 +1,69 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace TransportCompanyDatabaseImplements.Migrations
{
/// <inheritdoc />
public partial class StartMigration : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateIndex(
name: "IX_trucking_cargo_id",
table: "trucking",
column: "cargo_id");
migrationBuilder.CreateIndex(
name: "IX_trucking_client_id",
table: "trucking",
column: "client_id");
migrationBuilder.CreateIndex(
name: "IX_trucking_transport_id",
table: "trucking",
column: "transport_id");
migrationBuilder.CreateIndex(
name: "IX_trucking_type_transportation_id",
table: "trucking",
column: "type_transportation_id");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "trucking");
migrationBuilder.DropTable(
name: "cargo");
migrationBuilder.DropTable(
name: "client");
migrationBuilder.DropTable(
name: "transport");
migrationBuilder.DropTable(
name: "type_transportation");
migrationBuilder.DropSequence(
name: "seq_cargo");
migrationBuilder.DropSequence(
name: "seq_client");
migrationBuilder.DropSequence(
name: "seq_trucking");
migrationBuilder.DropSequence(
name: "seq_type_transport");
migrationBuilder.DropSequence(
name: "seq_type_transportation");
}
}
}

View File

@ -0,0 +1,236 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using TransportCompanyDatabaseImplements;
#nullable disable
namespace TransportCompanyDatabaseImplements.Migrations
{
[DbContext(typeof(ElegevContext))]
partial class ElegevContextModelSnapshot : 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.HasSequence("seq_cargo");
modelBuilder.HasSequence("seq_client");
modelBuilder.HasSequence("seq_trucking");
modelBuilder.HasSequence("seq_type_transport");
modelBuilder.HasSequence("seq_type_transportation");
modelBuilder.Entity("TransportCompanyDatabaseImplements.Models.Cargo", b =>
{
b.Property<int>("Id")
.HasColumnType("integer")
.HasColumnName("id");
b.Property<string>("TypeCargo")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("character varying(255)")
.HasColumnName("type_cargo");
b.HasKey("Id")
.HasName("cargo_pkey");
b.ToTable("cargo", (string)null);
});
modelBuilder.Entity("TransportCompanyDatabaseImplements.Models.Client", b =>
{
b.Property<int>("Id")
.HasColumnType("integer")
.HasColumnName("id");
b.Property<string>("Email")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("character varying(255)")
.HasColumnName("email");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("character varying(255)")
.HasColumnName("name");
b.Property<string>("Patronymic")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("character varying(255)")
.HasColumnName("patronymic");
b.Property<string>("Surname")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("character varying(255)")
.HasColumnName("surname");
b.Property<string>("Telephone")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("character varying(255)")
.HasColumnName("telephone");
b.HasKey("Id")
.HasName("client_pkey");
b.ToTable("client", (string)null);
});
modelBuilder.Entity("TransportCompanyDatabaseImplements.Models.Transport", b =>
{
b.Property<int>("Id")
.HasColumnType("integer")
.HasColumnName("id");
b.Property<string>("TransportType")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("character varying(255)")
.HasColumnName("transport_type");
b.HasKey("Id")
.HasName("transport_pkey");
b.ToTable("transport", (string)null);
});
modelBuilder.Entity("TransportCompanyDatabaseImplements.Models.Trucking", b =>
{
b.Property<int>("Id")
.HasColumnType("integer")
.HasColumnName("id");
b.Property<int>("CargoId")
.HasColumnType("integer")
.HasColumnName("cargo_id");
b.Property<int>("ClientId")
.HasColumnType("integer")
.HasColumnName("client_id");
b.Property<DateOnly>("DateEnd")
.HasColumnType("date")
.HasColumnName("date_end");
b.Property<DateOnly>("DateStart")
.HasColumnType("date")
.HasColumnName("date_start");
b.Property<int>("Price")
.HasColumnType("integer")
.HasColumnName("price");
b.Property<int>("TransportId")
.HasColumnType("integer")
.HasColumnName("transport_id");
b.Property<int>("TypeTransportationId")
.HasColumnType("integer")
.HasColumnName("type_transportation_id");
b.HasKey("Id")
.HasName("trucking_pkey");
b.HasIndex("CargoId");
b.HasIndex("ClientId");
b.HasIndex("TransportId");
b.HasIndex("TypeTransportationId");
b.ToTable("trucking", (string)null);
});
modelBuilder.Entity("TransportCompanyDatabaseImplements.Models.TypeTransportation", b =>
{
b.Property<int>("Id")
.HasColumnType("integer")
.HasColumnName("id");
b.Property<string>("TransportationType")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("character varying(255)")
.HasColumnName("transportation_type");
b.HasKey("Id")
.HasName("type_transportation_pkey");
b.ToTable("type_transportation", (string)null);
});
modelBuilder.Entity("TransportCompanyDatabaseImplements.Models.Trucking", b =>
{
b.HasOne("TransportCompanyDatabaseImplements.Models.Cargo", "Cargo")
.WithMany("Truckings")
.HasForeignKey("CargoId")
.IsRequired()
.HasConstraintName("cargo_id");
b.HasOne("TransportCompanyDatabaseImplements.Models.Client", "Client")
.WithMany("Truckings")
.HasForeignKey("ClientId")
.IsRequired()
.HasConstraintName("client_id");
b.HasOne("TransportCompanyDatabaseImplements.Models.Transport", "Transport")
.WithMany("Truckings")
.HasForeignKey("TransportId")
.IsRequired()
.HasConstraintName("transport_id");
b.HasOne("TransportCompanyDatabaseImplements.Models.TypeTransportation", "TypeTransportation")
.WithMany("Truckings")
.HasForeignKey("TypeTransportationId")
.IsRequired()
.HasConstraintName("type_transportation_id");
b.Navigation("Cargo");
b.Navigation("Client");
b.Navigation("Transport");
b.Navigation("TypeTransportation");
});
modelBuilder.Entity("TransportCompanyDatabaseImplements.Models.Cargo", b =>
{
b.Navigation("Truckings");
});
modelBuilder.Entity("TransportCompanyDatabaseImplements.Models.Client", b =>
{
b.Navigation("Truckings");
});
modelBuilder.Entity("TransportCompanyDatabaseImplements.Models.Transport", b =>
{
b.Navigation("Truckings");
});
modelBuilder.Entity("TransportCompanyDatabaseImplements.Models.TypeTransportation", b =>
{
b.Navigation("Truckings");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
namespace TransportCompanyDatabaseImplements.Models;
public partial class Cargo
{
public int Id { get; set; }
public string TypeCargo { get; set; } = null!;
public virtual ICollection<Trucking> Truckings { get; set; } = new List<Trucking>();
}

View File

@ -0,0 +1,57 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using TransportCompanyContracts.BindingModels;
using TransportCompanyContracts.ViewModels;
namespace TransportCompanyDatabaseImplements.Models;
public partial class Client
{
public int Id { get; set; }
public string Name { get; set; } = null!;
public string Surname { get; set; } = null!;
public string Patronymic { get; set; } = null!;
public string Telephone { get; set; } = null!;
public string Email { get; set; } = null!;
public virtual ICollection<Trucking> Truckings { get; set; } = new List<Trucking>();
public static Client Create(ElegevContext context, ClientBindingModel model)
{
return new Client()
{
Id = model.Id,
Name = model.Name,
Surname = model.Surname,
Patronymic = model.Patronymic,
Telephone = model.TelephoneNumber,
Email = model.Email,
};
}
public void Update(ClientBindingModel model)
{
Id = model.Id;
Name = model.Name;
Surname = model.Surname;
Patronymic = model.Patronymic;
Telephone = model.TelephoneNumber;
Email = model.Email;
}
public ClientViewModel GetViewModel => new()
{
Id = Id,
Name = Name,
Surname = Surname,
Patronymic = Patronymic,
TelephoneNumber = Telephone,
Email = Email
};
}

View File

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
namespace TransportCompanyDatabaseImplements.Models;
public partial class Transport
{
public int Id { get; set; }
public string TransportType { get; set; } = null!;
public virtual ICollection<Trucking> Truckings { get; set; } = new List<Trucking>();
}

View File

@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
namespace TransportCompanyDatabaseImplements.Models;
public partial class Trucking
{
public int Id { get; set; }
public int ClientId { get; set; }
public int CargoId { get; set; }
public int Price { get; set; }
public DateOnly DateStart { get; set; }
public DateOnly DateEnd { get; set; }
public int TypeTransportationId { get; set; }
public int TransportId { get; set; }
public virtual Cargo Cargo { get; set; } = null!;
public virtual Client Client { get; set; } = null!;
public virtual Transport Transport { get; set; } = null!;
public virtual TypeTransportation TypeTransportation { get; set; } = null!;
}

View File

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
namespace TransportCompanyDatabaseImplements.Models;
public partial class TypeTransportation
{
public int Id { get; set; }
public string TransportationType { get; set; } = null!;
public virtual ICollection<Trucking> Truckings { get; set; } = new List<Trucking>();
}

View File

@ -0,0 +1,27 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="7.0.3" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\TransportCompanyBusinessLogic\TransportCompanyBusinessLogic.csproj" />
<ProjectReference Include="..\TransportCompanyContracts\TransportCompanyContracts.csproj" />
<ProjectReference Include="..\TransportCompanyDataModels\TransportCompanyDataModels.csproj" />
</ItemGroup>
</Project>