Compare commits
3 Commits
main
...
CarService
Author | SHA1 | Date | |
---|---|---|---|
27d2bf43f7 | |||
32876640c2 | |||
4321d773e7 |
@ -5,6 +5,10 @@ VisualStudioVersion = 17.6.33717.318
|
|||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleMainApp", "ConsoleMainApp\ConsoleMainApp.csproj", "{4121A5A1-68DA-4F32-B8D6-EE5BA60C6890}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleMainApp", "ConsoleMainApp\ConsoleMainApp.csproj", "{4121A5A1-68DA-4F32-B8D6-EE5BA60C6890}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CarServiceDataBaseImplements", "CarServiceDataBaseImplements\CarServiceDataBaseImplements.csproj", "{48D159D4-7150-417E-BBE9-2B636E1EAFFB}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CarServiceDataModels", "CarServiceDataModels\CarServiceDataModels.csproj", "{7E6DC5DC-32CA-464C-884C-D949742DBF07}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
@ -15,6 +19,14 @@ Global
|
|||||||
{4121A5A1-68DA-4F32-B8D6-EE5BA60C6890}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{4121A5A1-68DA-4F32-B8D6-EE5BA60C6890}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{4121A5A1-68DA-4F32-B8D6-EE5BA60C6890}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{4121A5A1-68DA-4F32-B8D6-EE5BA60C6890}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{4121A5A1-68DA-4F32-B8D6-EE5BA60C6890}.Release|Any CPU.Build.0 = Release|Any CPU
|
{4121A5A1-68DA-4F32-B8D6-EE5BA60C6890}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{48D159D4-7150-417E-BBE9-2B636E1EAFFB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{48D159D4-7150-417E-BBE9-2B636E1EAFFB}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{48D159D4-7150-417E-BBE9-2B636E1EAFFB}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{48D159D4-7150-417E-BBE9-2B636E1EAFFB}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{7E6DC5DC-32CA-464C-884C-D949742DBF07}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{7E6DC5DC-32CA-464C-884C-D949742DBF07}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{7E6DC5DC-32CA-464C-884C-D949742DBF07}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{7E6DC5DC-32CA-464C-884C-D949742DBF07}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
@ -0,0 +1,27 @@
|
|||||||
|
using CarServiceDataBaseImplements.Models;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace CarServiceDataBaseImplements
|
||||||
|
{
|
||||||
|
public class CarServiceDataBase : DbContext
|
||||||
|
{
|
||||||
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||||
|
{
|
||||||
|
if (optionsBuilder.IsConfigured == false)
|
||||||
|
{
|
||||||
|
optionsBuilder.UseNpgsql("Host=localhost;Database=CarServiceDataBase;Username=postgres;Password=postgres");
|
||||||
|
}
|
||||||
|
base.OnConfiguring(optionsBuilder);
|
||||||
|
}
|
||||||
|
public virtual DbSet<Car> Cars { get; set; }
|
||||||
|
public virtual DbSet<Client> Clients { get; set; }
|
||||||
|
public virtual DbSet<Receipt> Receipts { get; set; }
|
||||||
|
public virtual DbSet<Service> Services { get; set; }
|
||||||
|
public virtual DbSet<Staff> Staffs { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net7.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.3" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.3">
|
||||||
|
<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="..\CarServiceDataModels\CarServiceDataModels.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
@ -0,0 +1,12 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace CarServiceDataBaseImplements.Contracts.LogicContracts
|
||||||
|
{
|
||||||
|
internal interface ICarLogic
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace CarServiceDataBaseImplements.Contracts.LogicContracts
|
||||||
|
{
|
||||||
|
internal interface IClientLogic
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace CarServiceDataBaseImplements.Contracts.LogicContracts
|
||||||
|
{
|
||||||
|
internal interface IReceiptLogic
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace CarServiceDataBaseImplements.Contracts.LogicContracts
|
||||||
|
{
|
||||||
|
internal interface IServiceLogic
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace CarServiceDataBaseImplements.Contracts.LogicContracts
|
||||||
|
{
|
||||||
|
internal interface IStaffLogic
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
using CarServiceDataModels.ModelsImplements;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace CarServiceDataBaseImplements.Contracts.StorageContracts
|
||||||
|
{
|
||||||
|
internal interface ICarStorage
|
||||||
|
{
|
||||||
|
List<CarModel> GetFullList();
|
||||||
|
CarModel? GetElement(CarModel model);
|
||||||
|
CarModel? Insert(CarModel model);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace CarServiceDataBaseImplements.Contracts.StorageContracts
|
||||||
|
{
|
||||||
|
internal interface IClientStorage
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace CarServiceDataBaseImplements.Contracts.StorageContracts
|
||||||
|
{
|
||||||
|
internal interface IReceiptStorage
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace CarServiceDataBaseImplements.Contracts.StorageContracts
|
||||||
|
{
|
||||||
|
internal interface IServiceStorage
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace CarServiceDataBaseImplements.Contracts.StorageContracts
|
||||||
|
{
|
||||||
|
internal interface IStaffStorage
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace CarServiceDataBaseImplements.DataBaseImplements
|
||||||
|
{
|
||||||
|
internal class CarStorage
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace CarServiceDataBaseImplements.DataBaseImplements
|
||||||
|
{
|
||||||
|
internal class ClientStorage
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace CarServiceDataBaseImplements.DataBaseImplements
|
||||||
|
{
|
||||||
|
internal class ReceiptStorage
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace CarServiceDataBaseImplements.DataBaseImplements
|
||||||
|
{
|
||||||
|
internal class ServiceStorage
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace CarServiceDataBaseImplements.DataBaseImplements
|
||||||
|
{
|
||||||
|
internal class StaffStorage
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
12
CarService/CarServiceDataBaseImplements/Logic/CarLogic.cs
Normal file
12
CarService/CarServiceDataBaseImplements/Logic/CarLogic.cs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace CarServiceDataBaseImplements.Logic
|
||||||
|
{
|
||||||
|
internal class CarLogic
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
12
CarService/CarServiceDataBaseImplements/Logic/ClientLogic.cs
Normal file
12
CarService/CarServiceDataBaseImplements/Logic/ClientLogic.cs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace CarServiceDataBaseImplements.Logic
|
||||||
|
{
|
||||||
|
internal class ClientLogic
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
125
CarService/CarServiceDataBaseImplements/Migrations/20240505121028_InitMigration.Designer.cs
generated
Normal file
125
CarService/CarServiceDataBaseImplements/Migrations/20240505121028_InitMigration.Designer.cs
generated
Normal file
@ -0,0 +1,125 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
using System;
|
||||||
|
using CarServiceDataBaseImplements;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace CarServiceDataBaseImplements.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(CarServiceDataBase))]
|
||||||
|
[Migration("20240505121028_InitMigration")]
|
||||||
|
partial class InitMigration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder
|
||||||
|
.HasAnnotation("ProductVersion", "7.0.3")
|
||||||
|
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||||
|
|
||||||
|
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||||
|
|
||||||
|
modelBuilder.Entity("CarServiceDataBaseImplements.Models.Car", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("Brand")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Cars");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("CarServiceDataBaseImplements.Models.Client", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("Email")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Clients");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("CarServiceDataBaseImplements.Models.Receipt", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<DateTime>("DateOfApplication")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Receipts");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("CarServiceDataBaseImplements.Models.Service", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<double>("Price")
|
||||||
|
.HasColumnType("double precision");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Services");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("CarServiceDataBaseImplements.Models.Staff", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("PositionAtWork")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Staffs");
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,103 @@
|
|||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace CarServiceDataBaseImplements.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class InitMigration : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Cars",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "integer", nullable: false)
|
||||||
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||||
|
Brand = table.Column<string>(type: "text", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Cars", x => x.Id);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Clients",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "integer", nullable: false)
|
||||||
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||||
|
Name = table.Column<string>(type: "text", nullable: false),
|
||||||
|
Email = table.Column<string>(type: "text", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Clients", x => x.Id);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Receipts",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "integer", nullable: false)
|
||||||
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||||
|
DateOfApplication = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Receipts", x => x.Id);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Services",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "integer", nullable: false)
|
||||||
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||||
|
Name = table.Column<string>(type: "text", nullable: false),
|
||||||
|
Price = table.Column<double>(type: "double precision", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Services", x => x.Id);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Staffs",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "integer", nullable: false)
|
||||||
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||||
|
Name = table.Column<string>(type: "text", nullable: false),
|
||||||
|
PositionAtWork = table.Column<string>(type: "text", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Staffs", x => x.Id);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Cars");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Clients");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Receipts");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Services");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Staffs");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,122 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
using System;
|
||||||
|
using CarServiceDataBaseImplements;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace CarServiceDataBaseImplements.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(CarServiceDataBase))]
|
||||||
|
partial class CarServiceDataBaseModelSnapshot : ModelSnapshot
|
||||||
|
{
|
||||||
|
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder
|
||||||
|
.HasAnnotation("ProductVersion", "7.0.3")
|
||||||
|
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||||
|
|
||||||
|
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||||
|
|
||||||
|
modelBuilder.Entity("CarServiceDataBaseImplements.Models.Car", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("Brand")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Cars");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("CarServiceDataBaseImplements.Models.Client", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("Email")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Clients");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("CarServiceDataBaseImplements.Models.Receipt", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<DateTime>("DateOfApplication")
|
||||||
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Receipts");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("CarServiceDataBaseImplements.Models.Service", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<double>("Price")
|
||||||
|
.HasColumnType("double precision");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Services");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("CarServiceDataBaseImplements.Models.Staff", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("PositionAtWork")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Staffs");
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
41
CarService/CarServiceDataBaseImplements/Models/Car.cs
Normal file
41
CarService/CarServiceDataBaseImplements/Models/Car.cs
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
using CarServiceDataModels.Models;
|
||||||
|
using CarServiceDataModels.ModelsImplements;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace CarServiceDataBaseImplements.Models
|
||||||
|
{
|
||||||
|
public class Car : ICar
|
||||||
|
{
|
||||||
|
[Required]
|
||||||
|
public string Brand {get; set;} = string.Empty;
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
public static Car? Create(CarModel? model)
|
||||||
|
{
|
||||||
|
if (model == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return new Car()
|
||||||
|
{
|
||||||
|
Id = model.Id,
|
||||||
|
Brand = model.Brand
|
||||||
|
};
|
||||||
|
}
|
||||||
|
public void Update(CarModel? model) {
|
||||||
|
if (model == null) { return; }
|
||||||
|
Brand = model.Brand;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CarModel GetViewModel => new()
|
||||||
|
{
|
||||||
|
Brand = Brand,
|
||||||
|
Id = Id
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
47
CarService/CarServiceDataBaseImplements/Models/Client.cs
Normal file
47
CarService/CarServiceDataBaseImplements/Models/Client.cs
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
using CarServiceDataModels.Models;
|
||||||
|
using CarServiceDataModels.ModelsImplements;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace CarServiceDataBaseImplements.Models
|
||||||
|
{
|
||||||
|
public class Client : IClient
|
||||||
|
{
|
||||||
|
[Required]
|
||||||
|
public string Name { get; set; } = String.Empty;
|
||||||
|
[Required]
|
||||||
|
public string Email { get; set; } = String.Empty;
|
||||||
|
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
public static Client? Create(ClientModel? model)
|
||||||
|
{
|
||||||
|
if (model == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return new Client()
|
||||||
|
{
|
||||||
|
Id = model.Id,
|
||||||
|
Name = model.Name,
|
||||||
|
Email = model.Email
|
||||||
|
};
|
||||||
|
}
|
||||||
|
public void Update(ClientModel? model)
|
||||||
|
{
|
||||||
|
if (model == null) { return; }
|
||||||
|
Name = model.Name;
|
||||||
|
Email = model.Email;
|
||||||
|
}
|
||||||
|
public ClientModel GetViewModel => new()
|
||||||
|
{
|
||||||
|
Name = Name,
|
||||||
|
Email = Email,
|
||||||
|
Id = Id
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
43
CarService/CarServiceDataBaseImplements/Models/Receipt.cs
Normal file
43
CarService/CarServiceDataBaseImplements/Models/Receipt.cs
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
using CarServiceDataModels.Models;
|
||||||
|
using CarServiceDataModels.ModelsImplements;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Xml.Linq;
|
||||||
|
|
||||||
|
namespace CarServiceDataBaseImplements.Models
|
||||||
|
{
|
||||||
|
public class Receipt : IReceipt
|
||||||
|
{
|
||||||
|
[Required]
|
||||||
|
public DateTime DateOfApplication { get; set; } = DateTime.Now;
|
||||||
|
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
public static Receipt? Create(ReceiptModel? model)
|
||||||
|
{
|
||||||
|
if (model == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return new Receipt()
|
||||||
|
{
|
||||||
|
Id = model.Id,
|
||||||
|
DateOfApplication = model.DateOfApplication,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
public void Update(ReceiptModel? model)
|
||||||
|
{
|
||||||
|
if (model == null) { return; }
|
||||||
|
DateOfApplication = model.DateOfApplication;
|
||||||
|
}
|
||||||
|
public ReceiptModel GetViewModel => new()
|
||||||
|
{
|
||||||
|
DateOfApplication = DateOfApplication,
|
||||||
|
Id = Id
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
48
CarService/CarServiceDataBaseImplements/Models/Service.cs
Normal file
48
CarService/CarServiceDataBaseImplements/Models/Service.cs
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
using CarServiceDataModels.Models;
|
||||||
|
using CarServiceDataModels.ModelsImplements;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace CarServiceDataBaseImplements.Models
|
||||||
|
{
|
||||||
|
public class Service : IService
|
||||||
|
{
|
||||||
|
[Required]
|
||||||
|
public string Name { get; set; }
|
||||||
|
[Required]
|
||||||
|
public double Price { get; set; }
|
||||||
|
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
public static Service? Create(ServiceModel? model)
|
||||||
|
{
|
||||||
|
if (model == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return new Service()
|
||||||
|
{
|
||||||
|
Id = model.Id,
|
||||||
|
Name = model.Name,
|
||||||
|
Price = model.Price
|
||||||
|
};
|
||||||
|
}
|
||||||
|
public void Update(ServiceModel? model)
|
||||||
|
{
|
||||||
|
if (model == null) { return; }
|
||||||
|
Name = model.Name;
|
||||||
|
Price = model.Price;
|
||||||
|
}
|
||||||
|
public ServiceModel GetViewModel => new()
|
||||||
|
{
|
||||||
|
Name = Name,
|
||||||
|
Price = Price,
|
||||||
|
Id = Id
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
49
CarService/CarServiceDataBaseImplements/Models/Staff.cs
Normal file
49
CarService/CarServiceDataBaseImplements/Models/Staff.cs
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
using CarServiceDataModels.Models;
|
||||||
|
using CarServiceDataModels.ModelsImplements;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace CarServiceDataBaseImplements.Models
|
||||||
|
{
|
||||||
|
public class Staff : IStaff
|
||||||
|
{
|
||||||
|
[Required]
|
||||||
|
public string Name { get; set; } = string.Empty;
|
||||||
|
[Required]
|
||||||
|
public string PositionAtWork { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
public static Staff? Create(StaffModel? model)
|
||||||
|
{
|
||||||
|
if (model == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return new Staff()
|
||||||
|
{
|
||||||
|
Id = model.Id,
|
||||||
|
Name = model.Name,
|
||||||
|
PositionAtWork = model.PositionAtWork,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
public void Update(StaffModel? model)
|
||||||
|
{
|
||||||
|
if (model == null) { return; }
|
||||||
|
Name = model.Name;
|
||||||
|
PositionAtWork = model.PositionAtWork;
|
||||||
|
}
|
||||||
|
public StaffModel GetViewModel => new()
|
||||||
|
{
|
||||||
|
Name = Name,
|
||||||
|
PositionAtWork = PositionAtWork,
|
||||||
|
Id = Id
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net7.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
</Project>
|
13
CarService/CarServiceDataModels/Models/ICar.cs
Normal file
13
CarService/CarServiceDataModels/Models/ICar.cs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace CarServiceDataModels.Models
|
||||||
|
{
|
||||||
|
public interface ICar : Iid
|
||||||
|
{
|
||||||
|
string Brand { get; }
|
||||||
|
}
|
||||||
|
}
|
15
CarService/CarServiceDataModels/Models/IClient.cs
Normal file
15
CarService/CarServiceDataModels/Models/IClient.cs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace CarServiceDataModels.Models
|
||||||
|
{
|
||||||
|
public interface IClient : Iid
|
||||||
|
{
|
||||||
|
string Name { get; }
|
||||||
|
string Email { get; }
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
14
CarService/CarServiceDataModels/Models/IReceipt.cs
Normal file
14
CarService/CarServiceDataModels/Models/IReceipt.cs
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace CarServiceDataModels.Models
|
||||||
|
{
|
||||||
|
public interface IReceipt : Iid
|
||||||
|
{
|
||||||
|
DateTime DateOfApplication { get; }
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
14
CarService/CarServiceDataModels/Models/IService.cs
Normal file
14
CarService/CarServiceDataModels/Models/IService.cs
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace CarServiceDataModels.Models
|
||||||
|
{
|
||||||
|
public interface IService : Iid
|
||||||
|
{
|
||||||
|
string Name { get; }
|
||||||
|
double Price { get; }
|
||||||
|
}
|
||||||
|
}
|
14
CarService/CarServiceDataModels/Models/IStaff.cs
Normal file
14
CarService/CarServiceDataModels/Models/IStaff.cs
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace CarServiceDataModels.Models
|
||||||
|
{
|
||||||
|
public interface IStaff : Iid
|
||||||
|
{
|
||||||
|
string Name { get; }
|
||||||
|
string PositionAtWork { get; }
|
||||||
|
}
|
||||||
|
}
|
13
CarService/CarServiceDataModels/Models/Iid.cs
Normal file
13
CarService/CarServiceDataModels/Models/Iid.cs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace CarServiceDataModels.Models
|
||||||
|
{
|
||||||
|
public interface Iid
|
||||||
|
{
|
||||||
|
int Id { get; }
|
||||||
|
}
|
||||||
|
}
|
16
CarService/CarServiceDataModels/ModelsImplements/CarModel.cs
Normal file
16
CarService/CarServiceDataModels/ModelsImplements/CarModel.cs
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
using CarServiceDataModels.Models;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace CarServiceDataModels.ModelsImplements
|
||||||
|
{
|
||||||
|
public class CarModel : ICar
|
||||||
|
{
|
||||||
|
public string Brand {get; set;} = string.Empty;
|
||||||
|
|
||||||
|
public int Id { get; set;}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
using CarServiceDataModels.Models;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace CarServiceDataModels.ModelsImplements
|
||||||
|
{
|
||||||
|
public class ClientModel : IClient
|
||||||
|
{
|
||||||
|
public string Name {get;set;} = string.Empty;
|
||||||
|
|
||||||
|
public string Email { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public int Id { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
using CarServiceDataModels.Models;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace CarServiceDataModels.ModelsImplements
|
||||||
|
{
|
||||||
|
public class ReceiptModel : IReceipt
|
||||||
|
{
|
||||||
|
public DateTime DateOfApplication { get; set; } = DateTime.Now;
|
||||||
|
|
||||||
|
public int Id { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
using CarServiceDataModels.Models;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace CarServiceDataModels.ModelsImplements
|
||||||
|
{
|
||||||
|
public class ServiceModel : IService
|
||||||
|
{
|
||||||
|
public string Name { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public double Price { get; set; }
|
||||||
|
|
||||||
|
public int Id { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
using CarServiceDataModels.Models;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace CarServiceDataModels.ModelsImplements
|
||||||
|
{
|
||||||
|
public class StaffModel : IStaff
|
||||||
|
{
|
||||||
|
public string Name { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public string PositionAtWork { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public int Id { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
@ -7,4 +7,16 @@
|
|||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.3">
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="Npgsql" Version="7.0.2" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\CarServiceDataBaseImplements\CarServiceDataBaseImplements.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -1,10 +1,28 @@
|
|||||||
namespace ConsoleMainApp
|
using CarServiceDataBaseImplements;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Npgsql;
|
||||||
|
|
||||||
|
namespace ConsoleMainApp
|
||||||
{
|
{
|
||||||
internal class Program
|
internal class Program
|
||||||
{
|
{
|
||||||
|
|
||||||
static void Main(string[] args)
|
static void Main(string[] args)
|
||||||
{
|
{
|
||||||
Console.WriteLine("Hello, World!");
|
using var context = new CarServiceDataBase();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
context.Database.OpenConnection();
|
||||||
|
Console.WriteLine("Connect open");
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
Console.WriteLine("Connect error");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
context.Database.CloseConnection();
|
||||||
|
if(context.Database.GetDbConnection().State == System.Data.ConnectionState.Open) {
|
||||||
|
Console.WriteLine("Connect still open");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user