Создание временных моделей и бд

This commit is contained in:
Мк Игорь 2023-04-02 16:04:50 +04:00
parent 0878bff8c7
commit 3f55e0a509
17 changed files with 1775 additions and 0 deletions

View File

@ -9,6 +9,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CarServiceContracts", "CarS
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CarServiceBusinessLogic", "CarServiceBusinessLogic\CarServiceBusinessLogic.csproj", "{F59A4E9C-1547-472A-ADE6-313D208430E1}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CarServiceBusinessLogic", "CarServiceBusinessLogic\CarServiceBusinessLogic.csproj", "{F59A4E9C-1547-472A-ADE6-313D208430E1}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CarServiceDatabase", "CarServiceDatabase\CarServiceDatabase.csproj", "{1E57DD5F-5110-457C-8D9F-E34BBFE75A1F}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@ -27,6 +29,10 @@ Global
{F59A4E9C-1547-472A-ADE6-313D208430E1}.Debug|Any CPU.Build.0 = Debug|Any CPU {F59A4E9C-1547-472A-ADE6-313D208430E1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F59A4E9C-1547-472A-ADE6-313D208430E1}.Release|Any CPU.ActiveCfg = Release|Any CPU {F59A4E9C-1547-472A-ADE6-313D208430E1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F59A4E9C-1547-472A-ADE6-313D208430E1}.Release|Any CPU.Build.0 = Release|Any CPU {F59A4E9C-1547-472A-ADE6-313D208430E1}.Release|Any CPU.Build.0 = Release|Any CPU
{1E57DD5F-5110-457C-8D9F-E34BBFE75A1F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1E57DD5F-5110-457C-8D9F-E34BBFE75A1F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1E57DD5F-5110-457C-8D9F-E34BBFE75A1F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1E57DD5F-5110-457C-8D9F-E34BBFE75A1F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

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" Version="7.0.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<Folder Include="Implements\" />
<Folder Include="Migrations\" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\CarServiceContracts\CarServiceContracts.csproj" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,33 @@
using CarServiceDatabase.Models;
using Microsoft.EntityFrameworkCore;
namespace CarServiceDatabase
{
public class CarServiceDbContext : DbContext
{
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
if (optionsBuilder.IsConfigured == false)
{
optionsBuilder.UseSqlServer
(
@"Data Source=IGORS_2011;
Initial Catalog=CarServiceDatabase;
Integrated Security=True;
MultipleActiveResultSets=True;
TrustServerCertificate=True"
);
}
base.OnConfiguring(optionsBuilder);
}
public virtual DbSet<Customer> Customers { get; set; }
public virtual DbSet<Item> Items { get; set; }
public virtual DbSet<ItemForRepair> ItemsForRepair { get; set; }
public virtual DbSet<RepairRequest> RepairRequests { get; set; }
public virtual DbSet<Vehicle> Vehicles { get; set; }
public virtual DbSet<Work> Works { get; set; }
public virtual DbSet<Worker> Workers { get; set; }
public virtual DbSet<WorkInRequest> WorksInRequest { get; set; }
public virtual DbSet<WorkPayment> WorkPayments { get; set; }
}
}

View File

@ -0,0 +1,386 @@
// <auto-generated />
using System;
using CarServiceDatabase;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace CarServiceDatabase.Migrations
{
[DbContext(typeof(CarServiceDbContext))]
[Migration("20230402115927_InitMigration")]
partial class InitMigration
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "7.0.4")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("CarServiceDatabase.Models.Customer", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Login")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Password")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Surname")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Customers");
});
modelBuilder.Entity("CarServiceDatabase.Models.Item", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("Count")
.HasColumnType("int");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<decimal>("Price")
.HasColumnType("decimal (10,2)");
b.Property<int>("WorkerId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("WorkerId");
b.ToTable("Items");
});
modelBuilder.Entity("CarServiceDatabase.Models.ItemForRepair", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("Count")
.HasColumnType("int");
b.Property<int>("ItemId")
.HasColumnType("int");
b.Property<int>("RepairRequestId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("ItemId");
b.HasIndex("RepairRequestId");
b.ToTable("ItemsForRepair");
});
modelBuilder.Entity("CarServiceDatabase.Models.RepairRequest", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<DateTime>("DateCreated")
.HasColumnType("datetime2");
b.Property<int>("VehicleId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("VehicleId");
b.ToTable("RepairRequests");
});
modelBuilder.Entity("CarServiceDatabase.Models.Vehicle", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("CustomerId")
.HasColumnType("int");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Plate")
.HasColumnType("nvarchar(max)");
b.Property<string>("VIN")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.HasIndex("CustomerId");
b.ToTable("Vehicles");
});
modelBuilder.Entity("CarServiceDatabase.Models.Work", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<decimal>("Duration")
.HasColumnType("decimal (3,1)");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<decimal>("Price")
.HasColumnType("decimal (10,2)");
b.Property<int>("WorkerId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("WorkerId");
b.ToTable("Works");
});
modelBuilder.Entity("CarServiceDatabase.Models.WorkInRequest", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<decimal>("Cost")
.HasColumnType("decimal (10,2)");
b.Property<int>("Count")
.HasColumnType("int");
b.Property<int>("RepairRequestId")
.HasColumnType("int");
b.Property<int>("WorkId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("RepairRequestId");
b.HasIndex("WorkId");
b.ToTable("WorksInRequest");
});
modelBuilder.Entity("CarServiceDatabase.Models.WorkPayment", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<DateTime>("DatePayment")
.HasColumnType("datetime2");
b.Property<decimal>("Sum")
.HasColumnType("decimal (10,2)");
b.Property<int>("WorkInRequestId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("WorkInRequestId");
b.ToTable("WorkPayments");
});
modelBuilder.Entity("CarServiceDatabase.Models.Worker", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Login")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Password")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Surname")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Workers");
});
modelBuilder.Entity("CarServiceDatabase.Models.Item", b =>
{
b.HasOne("CarServiceDatabase.Models.Worker", null)
.WithMany("Items")
.HasForeignKey("WorkerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("CarServiceDatabase.Models.ItemForRepair", b =>
{
b.HasOne("CarServiceDatabase.Models.Item", null)
.WithMany("ItemsForRepair")
.HasForeignKey("ItemId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("CarServiceDatabase.Models.RepairRequest", null)
.WithMany("ItemsForRepair")
.HasForeignKey("RepairRequestId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("CarServiceDatabase.Models.RepairRequest", b =>
{
b.HasOne("CarServiceDatabase.Models.Vehicle", null)
.WithMany("RepairRequests")
.HasForeignKey("VehicleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("CarServiceDatabase.Models.Vehicle", b =>
{
b.HasOne("CarServiceDatabase.Models.Customer", null)
.WithMany("Vehicles")
.HasForeignKey("CustomerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("CarServiceDatabase.Models.Work", b =>
{
b.HasOne("CarServiceDatabase.Models.Worker", null)
.WithMany("Works")
.HasForeignKey("WorkerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("CarServiceDatabase.Models.WorkInRequest", b =>
{
b.HasOne("CarServiceDatabase.Models.RepairRequest", null)
.WithMany("WorksInRequest")
.HasForeignKey("RepairRequestId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("CarServiceDatabase.Models.Work", null)
.WithMany("WorksInRequest")
.HasForeignKey("WorkId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("CarServiceDatabase.Models.WorkPayment", b =>
{
b.HasOne("CarServiceDatabase.Models.WorkInRequest", null)
.WithMany("WorkPayments")
.HasForeignKey("WorkInRequestId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("CarServiceDatabase.Models.Customer", b =>
{
b.Navigation("Vehicles");
});
modelBuilder.Entity("CarServiceDatabase.Models.Item", b =>
{
b.Navigation("ItemsForRepair");
});
modelBuilder.Entity("CarServiceDatabase.Models.RepairRequest", b =>
{
b.Navigation("ItemsForRepair");
b.Navigation("WorksInRequest");
});
modelBuilder.Entity("CarServiceDatabase.Models.Vehicle", b =>
{
b.Navigation("RepairRequests");
});
modelBuilder.Entity("CarServiceDatabase.Models.Work", b =>
{
b.Navigation("WorksInRequest");
});
modelBuilder.Entity("CarServiceDatabase.Models.WorkInRequest", b =>
{
b.Navigation("WorkPayments");
});
modelBuilder.Entity("CarServiceDatabase.Models.Worker", b =>
{
b.Navigation("Items");
b.Navigation("Works");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -0,0 +1,285 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace CarServiceDatabase.Migrations
{
/// <inheritdoc />
public partial class InitMigration : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Customers",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Login = table.Column<string>(type: "nvarchar(max)", nullable: false),
Password = table.Column<string>(type: "nvarchar(max)", nullable: false),
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
Surname = table.Column<string>(type: "nvarchar(max)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Customers", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Workers",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Login = table.Column<string>(type: "nvarchar(max)", nullable: false),
Password = table.Column<string>(type: "nvarchar(max)", nullable: false),
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
Surname = table.Column<string>(type: "nvarchar(max)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Workers", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Vehicles",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
Plate = table.Column<string>(type: "nvarchar(max)", nullable: true),
VIN = table.Column<string>(type: "nvarchar(max)", nullable: true),
CustomerId = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Vehicles", x => x.Id);
table.ForeignKey(
name: "FK_Vehicles_Customers_CustomerId",
column: x => x.CustomerId,
principalTable: "Customers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Items",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
Price = table.Column<decimal>(type: "decimal (10,2)", nullable: false),
Count = table.Column<int>(type: "int", nullable: false),
WorkerId = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Items", x => x.Id);
table.ForeignKey(
name: "FK_Items_Workers_WorkerId",
column: x => x.WorkerId,
principalTable: "Workers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Works",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
Price = table.Column<decimal>(type: "decimal (10,2)", nullable: false),
Duration = table.Column<decimal>(type: "decimal (3,1)", nullable: false),
WorkerId = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Works", x => x.Id);
table.ForeignKey(
name: "FK_Works_Workers_WorkerId",
column: x => x.WorkerId,
principalTable: "Workers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "RepairRequests",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
DateCreated = table.Column<DateTime>(type: "datetime2", nullable: false),
VehicleId = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_RepairRequests", x => x.Id);
table.ForeignKey(
name: "FK_RepairRequests_Vehicles_VehicleId",
column: x => x.VehicleId,
principalTable: "Vehicles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "ItemsForRepair",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Count = table.Column<int>(type: "int", nullable: false),
ItemId = table.Column<int>(type: "int", nullable: false),
RepairRequestId = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ItemsForRepair", x => x.Id);
table.ForeignKey(
name: "FK_ItemsForRepair_Items_ItemId",
column: x => x.ItemId,
principalTable: "Items",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_ItemsForRepair_RepairRequests_RepairRequestId",
column: x => x.RepairRequestId,
principalTable: "RepairRequests",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "WorksInRequest",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Count = table.Column<int>(type: "int", nullable: false),
Cost = table.Column<decimal>(type: "decimal (10,2)", nullable: false),
RepairRequestId = table.Column<int>(type: "int", nullable: false),
WorkId = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_WorksInRequest", x => x.Id);
table.ForeignKey(
name: "FK_WorksInRequest_RepairRequests_RepairRequestId",
column: x => x.RepairRequestId,
principalTable: "RepairRequests",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_WorksInRequest_Works_WorkId",
column: x => x.WorkId,
principalTable: "Works",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "WorkPayments",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
DatePayment = table.Column<DateTime>(type: "datetime2", nullable: false),
Sum = table.Column<decimal>(type: "decimal (10,2)", nullable: false),
WorkInRequestId = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_WorkPayments", x => x.Id);
table.ForeignKey(
name: "FK_WorkPayments_WorksInRequest_WorkInRequestId",
column: x => x.WorkInRequestId,
principalTable: "WorksInRequest",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_Items_WorkerId",
table: "Items",
column: "WorkerId");
migrationBuilder.CreateIndex(
name: "IX_ItemsForRepair_ItemId",
table: "ItemsForRepair",
column: "ItemId");
migrationBuilder.CreateIndex(
name: "IX_ItemsForRepair_RepairRequestId",
table: "ItemsForRepair",
column: "RepairRequestId");
migrationBuilder.CreateIndex(
name: "IX_RepairRequests_VehicleId",
table: "RepairRequests",
column: "VehicleId");
migrationBuilder.CreateIndex(
name: "IX_Vehicles_CustomerId",
table: "Vehicles",
column: "CustomerId");
migrationBuilder.CreateIndex(
name: "IX_WorkPayments_WorkInRequestId",
table: "WorkPayments",
column: "WorkInRequestId");
migrationBuilder.CreateIndex(
name: "IX_Works_WorkerId",
table: "Works",
column: "WorkerId");
migrationBuilder.CreateIndex(
name: "IX_WorksInRequest_RepairRequestId",
table: "WorksInRequest",
column: "RepairRequestId");
migrationBuilder.CreateIndex(
name: "IX_WorksInRequest_WorkId",
table: "WorksInRequest",
column: "WorkId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "ItemsForRepair");
migrationBuilder.DropTable(
name: "WorkPayments");
migrationBuilder.DropTable(
name: "Items");
migrationBuilder.DropTable(
name: "WorksInRequest");
migrationBuilder.DropTable(
name: "RepairRequests");
migrationBuilder.DropTable(
name: "Works");
migrationBuilder.DropTable(
name: "Vehicles");
migrationBuilder.DropTable(
name: "Workers");
migrationBuilder.DropTable(
name: "Customers");
}
}
}

View File

@ -0,0 +1,383 @@
// <auto-generated />
using System;
using CarServiceDatabase;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace CarServiceDatabase.Migrations
{
[DbContext(typeof(CarServiceDbContext))]
partial class CarServiceDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "7.0.4")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("CarServiceDatabase.Models.Customer", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Login")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Password")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Surname")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Customers");
});
modelBuilder.Entity("CarServiceDatabase.Models.Item", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("Count")
.HasColumnType("int");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<decimal>("Price")
.HasColumnType("decimal (10,2)");
b.Property<int>("WorkerId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("WorkerId");
b.ToTable("Items");
});
modelBuilder.Entity("CarServiceDatabase.Models.ItemForRepair", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("Count")
.HasColumnType("int");
b.Property<int>("ItemId")
.HasColumnType("int");
b.Property<int>("RepairRequestId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("ItemId");
b.HasIndex("RepairRequestId");
b.ToTable("ItemsForRepair");
});
modelBuilder.Entity("CarServiceDatabase.Models.RepairRequest", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<DateTime>("DateCreated")
.HasColumnType("datetime2");
b.Property<int>("VehicleId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("VehicleId");
b.ToTable("RepairRequests");
});
modelBuilder.Entity("CarServiceDatabase.Models.Vehicle", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("CustomerId")
.HasColumnType("int");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Plate")
.HasColumnType("nvarchar(max)");
b.Property<string>("VIN")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.HasIndex("CustomerId");
b.ToTable("Vehicles");
});
modelBuilder.Entity("CarServiceDatabase.Models.Work", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<decimal>("Duration")
.HasColumnType("decimal (3,1)");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<decimal>("Price")
.HasColumnType("decimal (10,2)");
b.Property<int>("WorkerId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("WorkerId");
b.ToTable("Works");
});
modelBuilder.Entity("CarServiceDatabase.Models.WorkInRequest", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<decimal>("Cost")
.HasColumnType("decimal (10,2)");
b.Property<int>("Count")
.HasColumnType("int");
b.Property<int>("RepairRequestId")
.HasColumnType("int");
b.Property<int>("WorkId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("RepairRequestId");
b.HasIndex("WorkId");
b.ToTable("WorksInRequest");
});
modelBuilder.Entity("CarServiceDatabase.Models.WorkPayment", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<DateTime>("DatePayment")
.HasColumnType("datetime2");
b.Property<decimal>("Sum")
.HasColumnType("decimal (10,2)");
b.Property<int>("WorkInRequestId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("WorkInRequestId");
b.ToTable("WorkPayments");
});
modelBuilder.Entity("CarServiceDatabase.Models.Worker", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Login")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Password")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Surname")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Workers");
});
modelBuilder.Entity("CarServiceDatabase.Models.Item", b =>
{
b.HasOne("CarServiceDatabase.Models.Worker", null)
.WithMany("Items")
.HasForeignKey("WorkerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("CarServiceDatabase.Models.ItemForRepair", b =>
{
b.HasOne("CarServiceDatabase.Models.Item", null)
.WithMany("ItemsForRepair")
.HasForeignKey("ItemId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("CarServiceDatabase.Models.RepairRequest", null)
.WithMany("ItemsForRepair")
.HasForeignKey("RepairRequestId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("CarServiceDatabase.Models.RepairRequest", b =>
{
b.HasOne("CarServiceDatabase.Models.Vehicle", null)
.WithMany("RepairRequests")
.HasForeignKey("VehicleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("CarServiceDatabase.Models.Vehicle", b =>
{
b.HasOne("CarServiceDatabase.Models.Customer", null)
.WithMany("Vehicles")
.HasForeignKey("CustomerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("CarServiceDatabase.Models.Work", b =>
{
b.HasOne("CarServiceDatabase.Models.Worker", null)
.WithMany("Works")
.HasForeignKey("WorkerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("CarServiceDatabase.Models.WorkInRequest", b =>
{
b.HasOne("CarServiceDatabase.Models.RepairRequest", null)
.WithMany("WorksInRequest")
.HasForeignKey("RepairRequestId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("CarServiceDatabase.Models.Work", null)
.WithMany("WorksInRequest")
.HasForeignKey("WorkId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("CarServiceDatabase.Models.WorkPayment", b =>
{
b.HasOne("CarServiceDatabase.Models.WorkInRequest", null)
.WithMany("WorkPayments")
.HasForeignKey("WorkInRequestId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("CarServiceDatabase.Models.Customer", b =>
{
b.Navigation("Vehicles");
});
modelBuilder.Entity("CarServiceDatabase.Models.Item", b =>
{
b.Navigation("ItemsForRepair");
});
modelBuilder.Entity("CarServiceDatabase.Models.RepairRequest", b =>
{
b.Navigation("ItemsForRepair");
b.Navigation("WorksInRequest");
});
modelBuilder.Entity("CarServiceDatabase.Models.Vehicle", b =>
{
b.Navigation("RepairRequests");
});
modelBuilder.Entity("CarServiceDatabase.Models.Work", b =>
{
b.Navigation("WorksInRequest");
});
modelBuilder.Entity("CarServiceDatabase.Models.WorkInRequest", b =>
{
b.Navigation("WorkPayments");
});
modelBuilder.Entity("CarServiceDatabase.Models.Worker", b =>
{
b.Navigation("Items");
b.Navigation("Works");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -0,0 +1,71 @@
using CarServiceContracts.BindingModels;
using CarServiceContracts.Models;
using CarServiceContracts.ViewModels;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace CarServiceDatabase.Models
{
public class Customer : ICustomerModel
{
public int Id { get; private set; }
[Required]
public string Login { get; private set; } = string.Empty;
[Required]
public string Password { get; private set; } = string.Empty;
[Required]
public string Name { get; private set; } = string.Empty;
[Required]
public string Surname { get; private set; } = string.Empty;
/// <summary>
/// Транспортные средства
/// </summary>
[ForeignKey("CustomerId")]
public virtual List<Vehicle> Vehicles { get; set; } = new();
public static Customer? Create(CustomerBindingModel? model)
{
if (model == null)
{
return null;
}
return new()
{
Id = model.Id,
Login = model.Login,
Password = model.Password,
Name = model.Name,
Surname = model.Surname
};
}
public static Customer Create(CustomerViewModel model)
{
return new()
{
Id = model.Id,
Login = model.Login,
Password = model.Password,
Name = model.Name,
Surname = model.Surname
};
}
public void Update(CustomerBindingModel? model)
{
if (model == null)
{
return;
}
Login = model.Login;
Password = model.Password;
Name = model.Name;
Surname = model.Surname;
}
public CustomerViewModel GetViewModel => new()
{
Id = Id,
Login = Login,
Password = Password,
Name = Name,
Surname = Surname
};
}
}

View File

@ -0,0 +1,72 @@
using CarServiceContracts.BindingModels;
using CarServiceContracts.Models;
using CarServiceContracts.ViewModels;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace CarServiceDatabase.Models
{
public class Item : IItemModel
{
public int Id { get; private set; }
[Required]
public string Name { get; private set; } = string.Empty;
[Required, Column(TypeName = "decimal (10,2)")]
public decimal Price { get; private set; }
[Required]
public int Count { get; private set; }
[Required]
public int WorkerId { get; private set; }
/// <summary>
/// Затраты на ремонт
/// </summary>
[ForeignKey("ItemId")]
public virtual List<ItemForRepair> ItemsForRepair { get; set; } = new();
public static Item? Create(ItemBindingModel? model)
{
if (model == null)
{
return null;
}
return new()
{
Id = model.Id,
Name = model.Name,
Price = model.Price,
Count = model.Count,
WorkerId = model.WorkerId
};
}
public static Item Create(ItemViewModel model)
{
return new()
{
Id = model.Id,
Name = model.Name,
Price = model.Price,
Count = model.Count,
WorkerId = model.WorkerId
};
}
public void Update(ItemBindingModel? model)
{
if (model == null)
{
return;
}
Id = model.Id;
Name = model.Name;
Price = model.Price;
Count = model.Count;
WorkerId = model.WorkerId;
}
public ItemViewModel GetViewModel => new()
{
Id = Id,
Name = Name,
Price = Price,
Count = Count,
WorkerId = WorkerId
};
}
}

View File

@ -0,0 +1,60 @@
using CarServiceContracts.BindingModels;
using CarServiceContracts.Models;
using CarServiceContracts.ViewModels;
using System.ComponentModel.DataAnnotations;
namespace CarServiceDatabase.Models
{
public class ItemForRepair : IItemForRepairModel
{
public int Id { get; private set; }
[Required]
public int Count { get; private set; }
[Required]
public int ItemId { get; private set; }
[Required]
public int RepairRequestId { get; private set; }
public static ItemForRepair? Create(ItemForRepairBindingModel? model)
{
if (model == null)
{
return null;
}
return new()
{
Id = model.Id,
Count = model.Count,
ItemId = model.ItemId,
RepairRequestId = model.RepairRequestId
};
}
public static ItemForRepair Create(ItemForRepairViewModel model)
{
return new()
{
Id = model.Id,
Count = model.Count,
ItemId = model.ItemId,
RepairRequestId = model.RepairRequestId
};
}
public void Update(ItemForRepairBindingModel? model)
{
if (model == null)
{
return;
}
Id = model.Id;
Count = model.Count;
ItemId = model.ItemId;
RepairRequestId = model.RepairRequestId;
}
public ItemForRepairViewModel GetViewModel => new()
{
Id = Id,
Count = Count,
ItemId = ItemId,
RepairRequestId = RepairRequestId
};
}
}

View File

@ -0,0 +1,65 @@
using CarServiceContracts.BindingModels;
using CarServiceContracts.Models;
using CarServiceContracts.ViewModels;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace CarServiceDatabase.Models
{
public class RepairRequest : IRepairRequestModel
{
public int Id { get; private set; }
[Required]
public DateTime DateCreated { get; private set; } = DateTime.Now;
[Required]
public int VehicleId { get; private set; }
/// <summary>
/// Работы в заявке
/// </summary>
[ForeignKey("RepairRequestId")]
public virtual List<WorkInRequest> WorksInRequest { get; set; } = new();
/// <summary>
/// Затраты на ремонт
/// </summary>
[ForeignKey("RepairRequestId")]
public virtual List<ItemForRepair> ItemsForRepair { get; set; } = new();
public static RepairRequest? Create(RepairRequestBindingModel? model)
{
if (model == null)
{
return null;
}
return new()
{
Id = model.Id,
DateCreated = model.DateCreated,
VehicleId = model.VehicleId
};
}
public static RepairRequest Create(RepairRequestViewModel model)
{
return new()
{
Id = model.Id,
DateCreated = model.DateCreated,
VehicleId = model.VehicleId
};
}
public void Update(RepairRequestBindingModel? model)
{
if (model == null)
{
return;
}
Id = model.Id;
DateCreated = model.DateCreated;
VehicleId = model.VehicleId;
}
public RepairRequestViewModel GetViewModel => new()
{
Id = Id,
DateCreated = DateCreated,
VehicleId = VehicleId
};
}
}

View File

@ -0,0 +1,70 @@
using CarServiceContracts.BindingModels;
using CarServiceContracts.Models;
using CarServiceContracts.ViewModels;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace CarServiceDatabase.Models
{
public class Vehicle : IVehicleModel
{
public int Id { get; private set; }
[Required]
public string Name { get; private set; } = string.Empty;
public string? Plate { get; private set; }
public string? VIN { get; private set; }
[Required]
public int CustomerId { get; private set; }
/// <summary>
/// Заявки на ремонт
/// </summary>
[ForeignKey("VehicleId")]
public virtual List<RepairRequest> RepairRequests { get; set; } = new();
public static Vehicle? Create(VehicleBindingModel? model)
{
if (model == null)
{
return null;
}
return new()
{
Id = model.Id,
Name = model.Name,
Plate = model.Plate,
VIN = model.VIN,
CustomerId = model.CustomerId
};
}
public static Vehicle Create(VehicleViewModel model)
{
return new()
{
Id = model.Id,
Name = model.Name,
Plate = model.Plate,
VIN = model.VIN,
CustomerId = model.CustomerId
};
}
public void Update(VehicleBindingModel? model)
{
if (model == null)
{
return;
}
Id = model.Id;
Name = model.Name;
Plate = model.Plate;
VIN = model.VIN;
CustomerId = model.CustomerId;
}
public VehicleViewModel GetViewModel => new()
{
Id = Id,
Name = Name,
Plate = Plate,
VIN = VIN,
CustomerId = CustomerId
};
}
}

View File

@ -0,0 +1,72 @@
using CarServiceContracts.BindingModels;
using CarServiceContracts.Models;
using CarServiceContracts.ViewModels;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace CarServiceDatabase.Models
{
public class Work : IWorkModel
{
public int Id { get; private set; }
[Required]
public string Name { get; private set; } = string.Empty;
[Required, Column(TypeName = "decimal (10,2)")]
public decimal Price { get; private set; }
[Required, Column(TypeName = "decimal (3,1)")]
public decimal Duration { get; private set; }
[Required]
public int WorkerId { get; private set; }
/// <summary>
/// Работы в заявке
/// </summary>
[ForeignKey("WorkId")]
public virtual List<WorkInRequest> WorksInRequest { get; set; } = new();
public static Work? Create(WorkBindingModel? model)
{
if (model == null)
{
return null;
}
return new()
{
Id = model.Id,
Name = model.Name,
Price = model.Price,
Duration = model.Duration,
WorkerId = model.WorkerId
};
}
public static Work Create(WorkViewModel model)
{
return new()
{
Id = model.Id,
Name = model.Name,
Price = model.Price,
Duration = model.Duration,
WorkerId = model.WorkerId
};
}
public void Update(WorkBindingModel? model)
{
if (model == null)
{
return;
}
Id = model.Id;
Name = model.Name;
Price = model.Price;
Duration = model.Duration;
WorkerId = model.WorkerId;
}
public WorkViewModel GetViewModel => new()
{
Id = Id,
Name = Name,
Price = Price,
Duration = Duration,
WorkerId = WorkerId
};
}
}

View File

@ -0,0 +1,72 @@
using CarServiceContracts.BindingModels;
using CarServiceContracts.Models;
using CarServiceContracts.ViewModels;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace CarServiceDatabase.Models
{
public class WorkInRequest : IWorkInRequestModel
{
public int Id { get; private set; }
[Required]
public int Count { get; private set; }
[Required, Column(TypeName = "decimal (10,2)")]
public decimal Cost { get; private set; }
[Required]
public int RepairRequestId { get; private set; }
[Required]
public int WorkId { get; private set; }
/// <summary>
/// Оплаты за ремонт
/// </summary>
[ForeignKey("WorkInRequestId")]
public virtual List<WorkPayment> WorkPayments { get; set; } = new();
public static WorkInRequest? Create(WorkInRequestBindingModel? model)
{
if (model == null)
{
return null;
}
return new()
{
Id = model.Id,
Count = model.Count,
Cost = model.Cost,
RepairRequestId = model.RepairRequestId,
WorkId = model.WorkId
};
}
public static WorkInRequest Create(WorkInRequestViewModel model)
{
return new()
{
Id = model.Id,
Count = model.Count,
Cost = model.Cost,
RepairRequestId = model.RepairRequestId,
WorkId = model.WorkId
};
}
public void Update(WorkInRequestBindingModel? model)
{
if (model == null)
{
return;
}
Id = model.Id;
Count = model.Count;
Cost = model.Cost;
RepairRequestId = model.RepairRequestId;
WorkId = model.WorkId;
}
public WorkInRequestViewModel GetViewModel => new()
{
Id = Id,
Count = Count,
Cost = Cost,
RepairRequestId = RepairRequestId,
WorkId = WorkId
};
}
}

View File

@ -0,0 +1,62 @@
using CarServiceContracts.BindingModels;
using CarServiceContracts.Models;
using CarServiceContracts.ViewModels;
using Microsoft.EntityFrameworkCore.Metadata.Internal;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace CarServiceDatabase.Models
{
public class WorkPayment : IWorkPaymentModel
{
public int Id { get; private set; }
[Required]
public DateTime DatePayment { get; private set; } = DateTime.Now;
[Required, Column(TypeName = "decimal (10,2)")]
public decimal Sum { get; private set; }
[Required]
public int WorkInRequestId { get; private set; }
public static WorkPayment? Create(WorkPaymentBindingModel? model)
{
if (model == null)
{
return null;
}
return new()
{
Id = model.Id,
DatePayment = model.DatePayment,
Sum = model.Sum,
WorkInRequestId = model.WorkInRequestId
};
}
public static WorkPayment Create(WorkPaymentViewModel model)
{
return new()
{
Id = model.Id,
DatePayment = model.DatePayment,
Sum = model.Sum,
WorkInRequestId = model.WorkInRequestId
};
}
public void Update(WorkPaymentBindingModel? model)
{
if (model == null)
{
return;
}
Id = model.Id;
DatePayment = model.DatePayment;
Sum = model.Sum;
WorkInRequestId = model.WorkInRequestId;
}
public WorkPaymentViewModel GetViewModel => new()
{
Id = Id,
DatePayment = DatePayment,
Sum = Sum,
WorkInRequestId = WorkInRequestId
};
}
}

View File

@ -0,0 +1,76 @@
using CarServiceContracts.BindingModels;
using CarServiceContracts.Models;
using CarServiceContracts.ViewModels;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
namespace CarServiceDatabase.Models
{
public class Worker : IWorkerModel
{
public int Id { get; private set; }
[Required]
public string Login { get; private set; } = string.Empty;
[Required]
public string Password { get; private set; } = string.Empty;
[Required]
public string Name { get; private set; } = string.Empty;
[Required]
public string Surname { get; private set; } = string.Empty;
/// <summary>
/// Работы
/// </summary>
[ForeignKey("WorkerId")]
public virtual List<Work> Works { get; set; } = new();
/// <summary>
/// Статьи затрат
/// </summary>
[ForeignKey("WorkerId")]
public virtual List<Item> Items { get; set; } = new();
public static Worker? Create(WorkerBindingModel? model)
{
if (model == null)
{
return null;
}
return new()
{
Id = model.Id,
Login = model.Login,
Password = model.Password,
Name = model.Name,
Surname = model.Surname
};
}
public static Worker Create(WorkerViewModel model)
{
return new()
{
Id = model.Id,
Login = model.Login,
Password = model.Password,
Name = model.Name,
Surname = model.Surname
};
}
public void Update(WorkerBindingModel? model)
{
if (model == null)
{
return;
}
Login = model.Login;
Password = model.Password;
Name = model.Name;
Surname = model.Surname;
}
public WorkerViewModel GetViewModel => new()
{
Id = Id,
Login = Login,
Password = Password,
Name = Name,
Surname = Surname
};
}
}

View File

@ -8,4 +8,25 @@
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<None Remove="nlog.config" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="nlog.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\CarServiceDatabase\CarServiceDatabase.csproj" />
</ItemGroup>
</Project> </Project>

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
autoReload="true" internalLogLevel="Info">
<targets>
<target xsi:type="File" name="tofile" fileName="${basedir}/log-${shortdate}.log" />
</targets>
<rules>
<logger name="*" minlevel="Debug" writeTo="tofile" />
</rules>
</nlog>
</configuration>