Исполнитель: сделал миграцию

This commit is contained in:
Yunusov_Niyaz 2024-05-01 12:47:48 +04:00
parent a99c69ffc9
commit 3d61d8907d
8 changed files with 1572 additions and 16 deletions

View File

@ -0,0 +1,558 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using VeterinaryDatabaseImplement;
#nullable disable
namespace VeterinaryDatabaseImplement.Migrations
{
[DbContext(typeof(VeterinaryDatabase))]
[Migration("20240501084519_InitialCreate")]
partial class InitialCreate
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "7.0.16")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Doctor", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("DoctorFIO")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Login")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Password")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Doctors");
});
modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Drug", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("Count")
.HasColumnType("int");
b.Property<string>("DrugName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<double>("Price")
.HasColumnType("float");
b.HasKey("Id");
b.ToTable("Drugs");
});
modelBuilder.Entity("VeterinaryDatabaseImplement.Models.DrugMedication", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("DrugId")
.HasColumnType("int");
b.Property<int>("MedicationId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("DrugId");
b.HasIndex("MedicationId");
b.ToTable("DrugMedications");
});
modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Medication", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("DoctorId")
.HasColumnType("int");
b.Property<string>("MedicationName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<double>("Price")
.HasColumnType("float");
b.HasKey("Id");
b.HasIndex("DoctorId");
b.ToTable("Medications");
});
modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Owner", 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>("OwnerFIO")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Password")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Owners");
});
modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Pet", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("OwnerId")
.HasColumnType("int");
b.Property<string>("PetBreed")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("PetGender")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("PetName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("PetType")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.HasIndex("OwnerId");
b.ToTable("Pets");
});
modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Purchase", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("Count")
.HasColumnType("int");
b.Property<DateTime>("DateCreate")
.HasColumnType("datetime2");
b.Property<DateTime>("DateImplement")
.HasColumnType("datetime2");
b.Property<int>("DrugId")
.HasColumnType("int");
b.Property<int>("OwnerId")
.HasColumnType("int");
b.Property<int>("Status")
.HasColumnType("int");
b.Property<double>("Sum")
.HasColumnType("float");
b.HasKey("Id");
b.HasIndex("DrugId");
b.HasIndex("OwnerId");
b.ToTable("Purchases");
});
modelBuilder.Entity("VeterinaryDatabaseImplement.Models.PurchasePet", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("PetId")
.HasColumnType("int");
b.Property<int>("PurchaseId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("PetId");
b.HasIndex("PurchaseId");
b.ToTable("PurchasePets");
});
modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Service", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("DoctorId")
.HasColumnType("int");
b.Property<string>("ServiceName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("VisitId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("DoctorId");
b.HasIndex("VisitId");
b.ToTable("Services");
});
modelBuilder.Entity("VeterinaryDatabaseImplement.Models.ServiceMedication", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("MedicationId")
.HasColumnType("int");
b.Property<int>("ServiceId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("MedicationId");
b.HasIndex("ServiceId");
b.ToTable("ServiceMedications");
});
modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Visit", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<DateTime>("DateVisit")
.HasColumnType("datetime2");
b.Property<int?>("DoctorId")
.IsRequired()
.HasColumnType("int");
b.Property<int>("OwnerId")
.HasColumnType("int");
b.Property<int>("Status")
.HasColumnType("int");
b.Property<string>("VisitName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.HasIndex("DoctorId");
b.HasIndex("OwnerId");
b.ToTable("Visits");
});
modelBuilder.Entity("VeterinaryDatabaseImplement.Models.VisitPet", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("PetId")
.HasColumnType("int");
b.Property<int>("VisitId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("PetId");
b.HasIndex("VisitId");
b.ToTable("VisitPets");
});
modelBuilder.Entity("VeterinaryDatabaseImplement.Models.DrugMedication", b =>
{
b.HasOne("VeterinaryDatabaseImplement.Models.Drug", "Drug")
.WithMany("Medications")
.HasForeignKey("DrugId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("VeterinaryDatabaseImplement.Models.Medication", "Medication")
.WithMany("DrugMedications")
.HasForeignKey("MedicationId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Drug");
b.Navigation("Medication");
});
modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Medication", b =>
{
b.HasOne("VeterinaryDatabaseImplement.Models.Doctor", null)
.WithMany("Medications")
.HasForeignKey("DoctorId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Pet", b =>
{
b.HasOne("VeterinaryDatabaseImplement.Models.Owner", null)
.WithMany("Pets")
.HasForeignKey("OwnerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Purchase", b =>
{
b.HasOne("VeterinaryDatabaseImplement.Models.Drug", "Drug")
.WithMany("Purchases")
.HasForeignKey("DrugId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("VeterinaryDatabaseImplement.Models.Owner", "Owner")
.WithMany("Purchases")
.HasForeignKey("OwnerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Drug");
b.Navigation("Owner");
});
modelBuilder.Entity("VeterinaryDatabaseImplement.Models.PurchasePet", b =>
{
b.HasOne("VeterinaryDatabaseImplement.Models.Pet", "Pet")
.WithMany("Purchases")
.HasForeignKey("PetId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("VeterinaryDatabaseImplement.Models.Purchase", "Purchase")
.WithMany("Pets")
.HasForeignKey("PurchaseId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Pet");
b.Navigation("Purchase");
});
modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Service", b =>
{
b.HasOne("VeterinaryDatabaseImplement.Models.Doctor", "Doctor")
.WithMany("Services")
.HasForeignKey("DoctorId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("VeterinaryDatabaseImplement.Models.Visit", null)
.WithMany("Services")
.HasForeignKey("VisitId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Doctor");
});
modelBuilder.Entity("VeterinaryDatabaseImplement.Models.ServiceMedication", b =>
{
b.HasOne("VeterinaryDatabaseImplement.Models.Medication", "Medication")
.WithMany("ServiceMedications")
.HasForeignKey("MedicationId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("VeterinaryDatabaseImplement.Models.Service", "Service")
.WithMany("Medications")
.HasForeignKey("ServiceId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Medication");
b.Navigation("Service");
});
modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Visit", b =>
{
b.HasOne("VeterinaryDatabaseImplement.Models.Doctor", "Doctor")
.WithMany("Visits")
.HasForeignKey("DoctorId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("VeterinaryDatabaseImplement.Models.Owner", "Owner")
.WithMany("Visits")
.HasForeignKey("OwnerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Doctor");
b.Navigation("Owner");
});
modelBuilder.Entity("VeterinaryDatabaseImplement.Models.VisitPet", b =>
{
b.HasOne("VeterinaryDatabaseImplement.Models.Pet", "Pet")
.WithMany("Visits")
.HasForeignKey("PetId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("VeterinaryDatabaseImplement.Models.Visit", "Visit")
.WithMany("Pets")
.HasForeignKey("VisitId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Pet");
b.Navigation("Visit");
});
modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Doctor", b =>
{
b.Navigation("Medications");
b.Navigation("Services");
b.Navigation("Visits");
});
modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Drug", b =>
{
b.Navigation("Medications");
b.Navigation("Purchases");
});
modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Medication", b =>
{
b.Navigation("DrugMedications");
b.Navigation("ServiceMedications");
});
modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Owner", b =>
{
b.Navigation("Pets");
b.Navigation("Purchases");
b.Navigation("Visits");
});
modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Pet", b =>
{
b.Navigation("Purchases");
b.Navigation("Visits");
});
modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Purchase", b =>
{
b.Navigation("Pets");
});
modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Service", b =>
{
b.Navigation("Medications");
});
modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Visit", b =>
{
b.Navigation("Pets");
b.Navigation("Services");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -0,0 +1,415 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace VeterinaryDatabaseImplement.Migrations
{
/// <inheritdoc />
public partial class InitialCreate : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Doctors",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
DoctorFIO = table.Column<string>(type: "nvarchar(max)", nullable: false),
Login = table.Column<string>(type: "nvarchar(max)", nullable: false),
Password = table.Column<string>(type: "nvarchar(max)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Doctors", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Drugs",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
DrugName = table.Column<string>(type: "nvarchar(max)", nullable: false),
Price = table.Column<double>(type: "float", nullable: false),
Count = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Drugs", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Owners",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
OwnerFIO = table.Column<string>(type: "nvarchar(max)", nullable: false),
Login = table.Column<string>(type: "nvarchar(max)", nullable: false),
Password = table.Column<string>(type: "nvarchar(max)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Owners", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Medications",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
MedicationName = table.Column<string>(type: "nvarchar(max)", nullable: false),
Price = table.Column<double>(type: "float", nullable: false),
DoctorId = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Medications", x => x.Id);
table.ForeignKey(
name: "FK_Medications_Doctors_DoctorId",
column: x => x.DoctorId,
principalTable: "Doctors",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Pets",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
OwnerId = table.Column<int>(type: "int", nullable: false),
PetName = table.Column<string>(type: "nvarchar(max)", nullable: false),
PetType = table.Column<string>(type: "nvarchar(max)", nullable: false),
PetBreed = table.Column<string>(type: "nvarchar(max)", nullable: false),
PetGender = table.Column<string>(type: "nvarchar(max)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Pets", x => x.Id);
table.ForeignKey(
name: "FK_Pets_Owners_OwnerId",
column: x => x.OwnerId,
principalTable: "Owners",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Purchases",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
OwnerId = table.Column<int>(type: "int", nullable: false),
DrugId = table.Column<int>(type: "int", nullable: false),
Count = table.Column<int>(type: "int", nullable: false),
Sum = table.Column<double>(type: "float", nullable: false),
Status = table.Column<int>(type: "int", nullable: false),
DateCreate = table.Column<DateTime>(type: "datetime2", nullable: false),
DateImplement = table.Column<DateTime>(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Purchases", x => x.Id);
table.ForeignKey(
name: "FK_Purchases_Drugs_DrugId",
column: x => x.DrugId,
principalTable: "Drugs",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Purchases_Owners_OwnerId",
column: x => x.OwnerId,
principalTable: "Owners",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Visits",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
OwnerId = table.Column<int>(type: "int", nullable: false),
DoctorId = table.Column<int>(type: "int", nullable: false),
VisitName = table.Column<string>(type: "nvarchar(max)", nullable: false),
Status = table.Column<int>(type: "int", nullable: false),
DateVisit = table.Column<DateTime>(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Visits", x => x.Id);
table.ForeignKey(
name: "FK_Visits_Doctors_DoctorId",
column: x => x.DoctorId,
principalTable: "Doctors",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Visits_Owners_OwnerId",
column: x => x.OwnerId,
principalTable: "Owners",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "DrugMedications",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
DrugId = table.Column<int>(type: "int", nullable: false),
MedicationId = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_DrugMedications", x => x.Id);
table.ForeignKey(
name: "FK_DrugMedications_Drugs_DrugId",
column: x => x.DrugId,
principalTable: "Drugs",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_DrugMedications_Medications_MedicationId",
column: x => x.MedicationId,
principalTable: "Medications",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "PurchasePets",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
PurchaseId = table.Column<int>(type: "int", nullable: false),
PetId = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_PurchasePets", x => x.Id);
table.ForeignKey(
name: "FK_PurchasePets_Pets_PetId",
column: x => x.PetId,
principalTable: "Pets",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_PurchasePets_Purchases_PurchaseId",
column: x => x.PurchaseId,
principalTable: "Purchases",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Services",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
ServiceName = table.Column<string>(type: "nvarchar(max)", nullable: false),
DoctorId = table.Column<int>(type: "int", nullable: false),
VisitId = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Services", x => x.Id);
table.ForeignKey(
name: "FK_Services_Doctors_DoctorId",
column: x => x.DoctorId,
principalTable: "Doctors",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Services_Visits_VisitId",
column: x => x.VisitId,
principalTable: "Visits",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "VisitPets",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
VisitId = table.Column<int>(type: "int", nullable: false),
PetId = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_VisitPets", x => x.Id);
table.ForeignKey(
name: "FK_VisitPets_Pets_PetId",
column: x => x.PetId,
principalTable: "Pets",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_VisitPets_Visits_VisitId",
column: x => x.VisitId,
principalTable: "Visits",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "ServiceMedications",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
ServiceId = table.Column<int>(type: "int", nullable: false),
MedicationId = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ServiceMedications", x => x.Id);
table.ForeignKey(
name: "FK_ServiceMedications_Medications_MedicationId",
column: x => x.MedicationId,
principalTable: "Medications",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_ServiceMedications_Services_ServiceId",
column: x => x.ServiceId,
principalTable: "Services",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_DrugMedications_DrugId",
table: "DrugMedications",
column: "DrugId");
migrationBuilder.CreateIndex(
name: "IX_DrugMedications_MedicationId",
table: "DrugMedications",
column: "MedicationId");
migrationBuilder.CreateIndex(
name: "IX_Medications_DoctorId",
table: "Medications",
column: "DoctorId");
migrationBuilder.CreateIndex(
name: "IX_Pets_OwnerId",
table: "Pets",
column: "OwnerId");
migrationBuilder.CreateIndex(
name: "IX_PurchasePets_PetId",
table: "PurchasePets",
column: "PetId");
migrationBuilder.CreateIndex(
name: "IX_PurchasePets_PurchaseId",
table: "PurchasePets",
column: "PurchaseId");
migrationBuilder.CreateIndex(
name: "IX_Purchases_DrugId",
table: "Purchases",
column: "DrugId");
migrationBuilder.CreateIndex(
name: "IX_Purchases_OwnerId",
table: "Purchases",
column: "OwnerId");
migrationBuilder.CreateIndex(
name: "IX_ServiceMedications_MedicationId",
table: "ServiceMedications",
column: "MedicationId");
migrationBuilder.CreateIndex(
name: "IX_ServiceMedications_ServiceId",
table: "ServiceMedications",
column: "ServiceId");
migrationBuilder.CreateIndex(
name: "IX_Services_DoctorId",
table: "Services",
column: "DoctorId");
migrationBuilder.CreateIndex(
name: "IX_Services_VisitId",
table: "Services",
column: "VisitId");
migrationBuilder.CreateIndex(
name: "IX_VisitPets_PetId",
table: "VisitPets",
column: "PetId");
migrationBuilder.CreateIndex(
name: "IX_VisitPets_VisitId",
table: "VisitPets",
column: "VisitId");
migrationBuilder.CreateIndex(
name: "IX_Visits_DoctorId",
table: "Visits",
column: "DoctorId");
migrationBuilder.CreateIndex(
name: "IX_Visits_OwnerId",
table: "Visits",
column: "OwnerId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "DrugMedications");
migrationBuilder.DropTable(
name: "PurchasePets");
migrationBuilder.DropTable(
name: "ServiceMedications");
migrationBuilder.DropTable(
name: "VisitPets");
migrationBuilder.DropTable(
name: "Purchases");
migrationBuilder.DropTable(
name: "Medications");
migrationBuilder.DropTable(
name: "Services");
migrationBuilder.DropTable(
name: "Pets");
migrationBuilder.DropTable(
name: "Drugs");
migrationBuilder.DropTable(
name: "Visits");
migrationBuilder.DropTable(
name: "Doctors");
migrationBuilder.DropTable(
name: "Owners");
}
}
}

View File

@ -0,0 +1,555 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using VeterinaryDatabaseImplement;
#nullable disable
namespace VeterinaryDatabaseImplement.Migrations
{
[DbContext(typeof(VeterinaryDatabase))]
partial class VeterinaryDatabaseModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "7.0.16")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Doctor", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("DoctorFIO")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Login")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Password")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Doctors");
});
modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Drug", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("Count")
.HasColumnType("int");
b.Property<string>("DrugName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<double>("Price")
.HasColumnType("float");
b.HasKey("Id");
b.ToTable("Drugs");
});
modelBuilder.Entity("VeterinaryDatabaseImplement.Models.DrugMedication", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("DrugId")
.HasColumnType("int");
b.Property<int>("MedicationId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("DrugId");
b.HasIndex("MedicationId");
b.ToTable("DrugMedications");
});
modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Medication", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("DoctorId")
.HasColumnType("int");
b.Property<string>("MedicationName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<double>("Price")
.HasColumnType("float");
b.HasKey("Id");
b.HasIndex("DoctorId");
b.ToTable("Medications");
});
modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Owner", 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>("OwnerFIO")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Password")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Owners");
});
modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Pet", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("OwnerId")
.HasColumnType("int");
b.Property<string>("PetBreed")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("PetGender")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("PetName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("PetType")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.HasIndex("OwnerId");
b.ToTable("Pets");
});
modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Purchase", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("Count")
.HasColumnType("int");
b.Property<DateTime>("DateCreate")
.HasColumnType("datetime2");
b.Property<DateTime>("DateImplement")
.HasColumnType("datetime2");
b.Property<int>("DrugId")
.HasColumnType("int");
b.Property<int>("OwnerId")
.HasColumnType("int");
b.Property<int>("Status")
.HasColumnType("int");
b.Property<double>("Sum")
.HasColumnType("float");
b.HasKey("Id");
b.HasIndex("DrugId");
b.HasIndex("OwnerId");
b.ToTable("Purchases");
});
modelBuilder.Entity("VeterinaryDatabaseImplement.Models.PurchasePet", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("PetId")
.HasColumnType("int");
b.Property<int>("PurchaseId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("PetId");
b.HasIndex("PurchaseId");
b.ToTable("PurchasePets");
});
modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Service", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("DoctorId")
.HasColumnType("int");
b.Property<string>("ServiceName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("VisitId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("DoctorId");
b.HasIndex("VisitId");
b.ToTable("Services");
});
modelBuilder.Entity("VeterinaryDatabaseImplement.Models.ServiceMedication", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("MedicationId")
.HasColumnType("int");
b.Property<int>("ServiceId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("MedicationId");
b.HasIndex("ServiceId");
b.ToTable("ServiceMedications");
});
modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Visit", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<DateTime>("DateVisit")
.HasColumnType("datetime2");
b.Property<int?>("DoctorId")
.IsRequired()
.HasColumnType("int");
b.Property<int>("OwnerId")
.HasColumnType("int");
b.Property<int>("Status")
.HasColumnType("int");
b.Property<string>("VisitName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.HasIndex("DoctorId");
b.HasIndex("OwnerId");
b.ToTable("Visits");
});
modelBuilder.Entity("VeterinaryDatabaseImplement.Models.VisitPet", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("PetId")
.HasColumnType("int");
b.Property<int>("VisitId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("PetId");
b.HasIndex("VisitId");
b.ToTable("VisitPets");
});
modelBuilder.Entity("VeterinaryDatabaseImplement.Models.DrugMedication", b =>
{
b.HasOne("VeterinaryDatabaseImplement.Models.Drug", "Drug")
.WithMany("Medications")
.HasForeignKey("DrugId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("VeterinaryDatabaseImplement.Models.Medication", "Medication")
.WithMany("DrugMedications")
.HasForeignKey("MedicationId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Drug");
b.Navigation("Medication");
});
modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Medication", b =>
{
b.HasOne("VeterinaryDatabaseImplement.Models.Doctor", null)
.WithMany("Medications")
.HasForeignKey("DoctorId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Pet", b =>
{
b.HasOne("VeterinaryDatabaseImplement.Models.Owner", null)
.WithMany("Pets")
.HasForeignKey("OwnerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Purchase", b =>
{
b.HasOne("VeterinaryDatabaseImplement.Models.Drug", "Drug")
.WithMany("Purchases")
.HasForeignKey("DrugId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("VeterinaryDatabaseImplement.Models.Owner", "Owner")
.WithMany("Purchases")
.HasForeignKey("OwnerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Drug");
b.Navigation("Owner");
});
modelBuilder.Entity("VeterinaryDatabaseImplement.Models.PurchasePet", b =>
{
b.HasOne("VeterinaryDatabaseImplement.Models.Pet", "Pet")
.WithMany("Purchases")
.HasForeignKey("PetId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("VeterinaryDatabaseImplement.Models.Purchase", "Purchase")
.WithMany("Pets")
.HasForeignKey("PurchaseId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Pet");
b.Navigation("Purchase");
});
modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Service", b =>
{
b.HasOne("VeterinaryDatabaseImplement.Models.Doctor", "Doctor")
.WithMany("Services")
.HasForeignKey("DoctorId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("VeterinaryDatabaseImplement.Models.Visit", null)
.WithMany("Services")
.HasForeignKey("VisitId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Doctor");
});
modelBuilder.Entity("VeterinaryDatabaseImplement.Models.ServiceMedication", b =>
{
b.HasOne("VeterinaryDatabaseImplement.Models.Medication", "Medication")
.WithMany("ServiceMedications")
.HasForeignKey("MedicationId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("VeterinaryDatabaseImplement.Models.Service", "Service")
.WithMany("Medications")
.HasForeignKey("ServiceId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Medication");
b.Navigation("Service");
});
modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Visit", b =>
{
b.HasOne("VeterinaryDatabaseImplement.Models.Doctor", "Doctor")
.WithMany("Visits")
.HasForeignKey("DoctorId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("VeterinaryDatabaseImplement.Models.Owner", "Owner")
.WithMany("Visits")
.HasForeignKey("OwnerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Doctor");
b.Navigation("Owner");
});
modelBuilder.Entity("VeterinaryDatabaseImplement.Models.VisitPet", b =>
{
b.HasOne("VeterinaryDatabaseImplement.Models.Pet", "Pet")
.WithMany("Visits")
.HasForeignKey("PetId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("VeterinaryDatabaseImplement.Models.Visit", "Visit")
.WithMany("Pets")
.HasForeignKey("VisitId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Pet");
b.Navigation("Visit");
});
modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Doctor", b =>
{
b.Navigation("Medications");
b.Navigation("Services");
b.Navigation("Visits");
});
modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Drug", b =>
{
b.Navigation("Medications");
b.Navigation("Purchases");
});
modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Medication", b =>
{
b.Navigation("DrugMedications");
b.Navigation("ServiceMedications");
});
modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Owner", b =>
{
b.Navigation("Pets");
b.Navigation("Purchases");
b.Navigation("Visits");
});
modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Pet", b =>
{
b.Navigation("Purchases");
b.Navigation("Visits");
});
modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Purchase", b =>
{
b.Navigation("Pets");
});
modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Service", b =>
{
b.Navigation("Medications");
});
modelBuilder.Entity("VeterinaryDatabaseImplement.Models.Visit", b =>
{
b.Navigation("Pets");
b.Navigation("Services");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8" ?>
<log4net>
<appender name="RollingFile" type="log4net.Appender.RollingFileAppender">
<file value="c:/temp/VeterinaryRestApi.log" />
<appendToFile value="true" />
<maximumFileSize value="100KB" />
<maxSizeRollBackups value="2" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date %5level %logger.%method [%line] - MESSAGE: %message%newline %exception" />
</layout>
</appender>
<root>
<level value="TRACE" />
<appender-ref ref="RollingFile" />
</root>
</log4net>

View File

@ -7,6 +7,10 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.16">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>

View File

@ -7,20 +7,16 @@
</PropertyGroup>
<ItemGroup>
<Content Remove="Views\Home\CreateVisit.cshtml" />
<Content Remove="Views\Home\UpdatePet.cshtml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Views\Home\UpdatePet.cshtml" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.16">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\VeterinaryContracts\VeterinaryContracts.csproj" />
<ProjectReference Include="..\VeterinaryRestApi\VeterinaryRestApi.csproj" />
</ItemGroup>
<ItemGroup>

View File

@ -1,5 +1,5 @@
@{
ViewData["Title"] = "UpdateMedicine";
ViewData["Title"] = "UpdatePet";
}
<div class="text-center">
@ -20,7 +20,7 @@
<div class="col-4">Вид:</div>
<div class="col-8"><input type="text" id="type" name="type" class="form-control" /></div>
</div>
<div class="row">
<div class="row">
<div class="col-4">Порода:</div>
<div class="col-8"><input type="text" id="breed" name="breed" class="form-control" /></div>
</div>
@ -32,7 +32,7 @@
</form>
@section Scripts
{
{
<script>
function check() {
var pet = $('#pet').val();

View File

@ -12,7 +12,7 @@
<header>
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow mb-3">
<div class="container-fluid">
<a class="navbar-brand" asp-area="" asp-controller="Home" asp-action="Index">VeterinaryShowOwnerApp</a>
<a class="navbar-brand" asp-area="" asp-controller="Home" asp-action="Index">Ветеринарная клиника</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target=".navbar-collapse" aria-controls="navbarSupportedContent"
aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
@ -20,10 +20,22 @@
<div class="navbar-collapse collapse d-sm-inline-flex justify-content-between">
<ul class="navbar-nav flex-grow-1">
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Index">Home</a>
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="Index">Животные</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="Visits">Посещения</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="Purchases">Покупки</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="Privacy">Личные данные</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="Enter">Вход</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="Register">Регистрация</a>
</li>
</ul>
</div>
@ -38,7 +50,7 @@
<footer class="border-top footer text-muted">
<div class="container">
&copy; 2024 - VeterinaryShowOwnerApp - <a asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
&copy; 2024 - Ветеринарная клиника - <a asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
</div>
</footer>
<script src="~/lib/jquery/dist/jquery.min.js"></script>