поручитель ща пересоберет миграцию
This commit is contained in:
parent
05c9929870
commit
39a8d5a564
@ -13,7 +13,7 @@ namespace VeterinaryContracts.BindingModels
|
||||
public string DrugName { get; set; } = string.Empty;
|
||||
public int Count { get; set; }
|
||||
public double Price { get; set; }
|
||||
public Dictionary<int, (IMedicationModel, int)> DrugMedications
|
||||
public Dictionary<int, IMedicationModel> DrugMedications
|
||||
{
|
||||
get;
|
||||
set;
|
||||
|
@ -13,7 +13,7 @@ namespace VeterinaryContracts.BindingModels
|
||||
public string ServiceName { get; set; } = string.Empty;
|
||||
public int VisitId { get; set; }
|
||||
public int DoctorId { get; set; }
|
||||
public Dictionary<int, (IMedicationModel, int)> ServiceMedications
|
||||
public Dictionary<int, IMedicationModel> ServiceMedications
|
||||
{
|
||||
get;
|
||||
set;
|
||||
|
@ -18,7 +18,7 @@ namespace VeterinaryContracts.ViewModels
|
||||
[DisplayName("Цена лекарства")]
|
||||
public double Price { get; set; }
|
||||
|
||||
public Dictionary<int, (IMedicationModel, int)> DrugMedications
|
||||
public Dictionary<int, IMedicationModel> DrugMedications
|
||||
{
|
||||
get;
|
||||
set;
|
||||
|
@ -15,7 +15,7 @@ namespace VeterinaryContracts.ViewModels
|
||||
public string ServiceName { get; set; } = string.Empty;
|
||||
public int VisitId { get; set; }
|
||||
public int DoctorId { get; set; }
|
||||
public Dictionary<int, (IMedicationModel, int)> ServiceMedications
|
||||
public Dictionary<int, IMedicationModel> ServiceMedications
|
||||
{
|
||||
get;
|
||||
set;
|
||||
|
@ -11,6 +11,6 @@ namespace VeterinaryDataModels
|
||||
string DrugName { get; }
|
||||
int Count { get; }
|
||||
double Price { get; }
|
||||
Dictionary<int, (IMedicationModel, int)> DrugMedications { get; }
|
||||
Dictionary<int, IMedicationModel> DrugMedications { get; }
|
||||
}
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ namespace VeterinaryDataModels
|
||||
String ServiceName { get;}
|
||||
int VisitId { get; }
|
||||
int DoctorId { get; }
|
||||
Dictionary<int, (IMedicationModel, int)> ServiceMedications { get; }
|
||||
Dictionary<int, IMedicationModel> ServiceMedications { get; }
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,551 +0,0 @@
|
||||
// <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("20240427075947_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>("Count")
|
||||
.HasColumnType("int");
|
||||
|
||||
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>("DatePurchase")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("DrugId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("OwnerId")
|
||||
.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>("Count")
|
||||
.HasColumnType("int");
|
||||
|
||||
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.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("PurchasePets")
|
||||
.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("VisitPets")
|
||||
.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("PurchasePets");
|
||||
|
||||
b.Navigation("VisitPets");
|
||||
});
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
@ -1,413 +0,0 @@
|
||||
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.Restrict);
|
||||
});
|
||||
|
||||
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.Restrict);
|
||||
});
|
||||
|
||||
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),
|
||||
DatePurchase = 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.Restrict);
|
||||
});
|
||||
|
||||
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),
|
||||
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.Restrict);
|
||||
table.ForeignKey(
|
||||
name: "FK_Visits_Owners_OwnerId",
|
||||
column: x => x.OwnerId,
|
||||
principalTable: "Owners",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
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),
|
||||
Count = 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.Restrict);
|
||||
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),
|
||||
Count = 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");
|
||||
}
|
||||
}
|
||||
}
|
@ -1,548 +0,0 @@
|
||||
// <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>("Count")
|
||||
.HasColumnType("int");
|
||||
|
||||
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>("DatePurchase")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("DrugId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("OwnerId")
|
||||
.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>("Count")
|
||||
.HasColumnType("int");
|
||||
|
||||
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.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("PurchasePets")
|
||||
.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("VisitPets")
|
||||
.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("PurchasePets");
|
||||
|
||||
b.Navigation("VisitPets");
|
||||
});
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
@ -20,9 +20,9 @@ namespace VeterinaryDatabaseImplement.Models
|
||||
public double Price { get; set; }
|
||||
[Required]
|
||||
public int Count { get; set; }
|
||||
private Dictionary<int, (IMedicationModel, int)>? _drugMedications = null;
|
||||
private Dictionary<int, IMedicationModel>? _drugMedications = null;
|
||||
[NotMapped]
|
||||
public Dictionary<int, (IMedicationModel, int)> DrugMedications
|
||||
public Dictionary<int, IMedicationModel> DrugMedications
|
||||
{
|
||||
get
|
||||
{
|
||||
@ -30,7 +30,7 @@ namespace VeterinaryDatabaseImplement.Models
|
||||
{
|
||||
_drugMedications = Medications
|
||||
.ToDictionary(recPC => recPC.MedicationId, recPC =>
|
||||
(recPC.Medication as IMedicationModel, recPC.Count));
|
||||
(recPC.Medication as IMedicationModel));
|
||||
}
|
||||
return _drugMedications;
|
||||
}
|
||||
@ -49,8 +49,7 @@ namespace VeterinaryDatabaseImplement.Models
|
||||
Count = model.Count,
|
||||
Medications = model.DrugMedications.Select(x => new DrugMedication
|
||||
{
|
||||
Medication = context.Medications.First(y => y.Id == x.Key),
|
||||
Count = x.Value.Item2
|
||||
Medication = context.Medications.First(y => y.Id == x.Key)
|
||||
}).ToList()
|
||||
};
|
||||
}
|
||||
@ -75,8 +74,6 @@ namespace VeterinaryDatabaseImplement.Models
|
||||
context.SaveChanges();
|
||||
foreach (var updateMedication in drugMedications)
|
||||
{
|
||||
updateMedication.Count =
|
||||
model.DrugMedications[updateMedication.MedicationId].Item2;
|
||||
model.DrugMedications.Remove(updateMedication.MedicationId);
|
||||
}
|
||||
context.SaveChanges();
|
||||
@ -87,8 +84,7 @@ namespace VeterinaryDatabaseImplement.Models
|
||||
context.DrugMedications.Add(new DrugMedication
|
||||
{
|
||||
Drug = drug,
|
||||
Medication = context.Medications.First(x => x.Id == pc.Key),
|
||||
Count = pc.Value.Item2
|
||||
Medication = context.Medications.First(x => x.Id == pc.Key)
|
||||
});
|
||||
context.SaveChanges();
|
||||
}
|
||||
|
@ -15,8 +15,6 @@ namespace VeterinaryDatabaseImplement.Models
|
||||
public int DrugId { get; set; }
|
||||
[Required]
|
||||
public int MedicationId { get; set; }
|
||||
[Required]
|
||||
public int Count { get; set; }
|
||||
public virtual Medication Medication { get; set; } = new();
|
||||
public virtual Drug Drug { get; set; } = new();
|
||||
}
|
||||
|
@ -22,9 +22,9 @@ namespace VeterinaryDatabaseImplement.Models
|
||||
[Required]
|
||||
public int VisitId { get; private set; }
|
||||
public virtual Doctor? Doctor { get; private set; }
|
||||
private Dictionary<int, (IMedicationModel, int)>? _serviceMedications = null;
|
||||
private Dictionary<int, IMedicationModel>? _serviceMedications = null;
|
||||
[NotMapped]
|
||||
public Dictionary<int, (IMedicationModel, int)> ServiceMedications
|
||||
public Dictionary<int, IMedicationModel> ServiceMedications
|
||||
{
|
||||
get
|
||||
{
|
||||
@ -32,7 +32,7 @@ namespace VeterinaryDatabaseImplement.Models
|
||||
{
|
||||
_serviceMedications = Medications
|
||||
.ToDictionary(recPC => recPC.MedicationId, recPC =>
|
||||
(recPC.Medication as IMedicationModel, recPC.Count));
|
||||
(recPC.Medication as IMedicationModel));
|
||||
}
|
||||
return _serviceMedications;
|
||||
}
|
||||
@ -49,8 +49,7 @@ namespace VeterinaryDatabaseImplement.Models
|
||||
VisitId = model.VisitId,
|
||||
Medications = model.ServiceMedications.Select(x => new ServiceMedication
|
||||
{
|
||||
Medication = context.Medications.First(y => y.Id == x.Key),
|
||||
Count = x.Value.Item2
|
||||
Medication = context.Medications.First(y => y.Id == x.Key)
|
||||
}).ToList()
|
||||
};
|
||||
}
|
||||
@ -76,8 +75,6 @@ namespace VeterinaryDatabaseImplement.Models
|
||||
context.SaveChanges();
|
||||
foreach (var updateMedication in serviceMedications)
|
||||
{
|
||||
updateMedication.Count =
|
||||
model.ServiceMedications[updateMedication.MedicationId].Item2;
|
||||
model.ServiceMedications.Remove(updateMedication.MedicationId);
|
||||
}
|
||||
context.SaveChanges();
|
||||
@ -88,8 +85,7 @@ namespace VeterinaryDatabaseImplement.Models
|
||||
context.ServiceMedications.Add(new ServiceMedication
|
||||
{
|
||||
Service = service,
|
||||
Medication = context.Medications.First(x => x.Id == pc.Key),
|
||||
Count = pc.Value.Item2
|
||||
Medication = context.Medications.First(x => x.Id == pc.Key)
|
||||
});
|
||||
context.SaveChanges();
|
||||
}
|
||||
|
@ -14,8 +14,6 @@ namespace VeterinaryDatabaseImplement.Models
|
||||
public int ServiceId { get; set; }
|
||||
[Required]
|
||||
public int MedicationId { get; set; }
|
||||
[Required]
|
||||
public int Count { get; set; }
|
||||
public virtual Medication Medication { get; set; } = new();
|
||||
public virtual Service Service { get; set; } = new();
|
||||
}
|
||||
|
@ -19,14 +19,14 @@ namespace VeterinaryRestApi.Controllers
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public Tuple<DrugViewModel, List<Tuple<string, int>>>? GetDrug(int drugId)
|
||||
public Tuple<DrugViewModel, List<string>>? GetDrug(int drugId)
|
||||
{
|
||||
try
|
||||
{
|
||||
var elem = _drug.ReadElement(new DrugSearchModel { Id = drugId });
|
||||
if (elem == null)
|
||||
return null;
|
||||
return Tuple.Create(elem, elem.DrugMedications.Select(x => Tuple.Create(x.Value.Item1.MedicationName, x.Value.Item2)).ToList());
|
||||
return Tuple.Create(elem, elem.DrugMedications.Select(x => x.Value.MedicationName).ToList());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@ -19,14 +19,14 @@ namespace VeterinaryRestApi.Controllers
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public Tuple<ServiceViewModel, List<Tuple<string, int>>>? GetService(int serviceId)
|
||||
public Tuple<ServiceViewModel, List<string>>? GetService(int serviceId)
|
||||
{
|
||||
try
|
||||
{
|
||||
var elem = _service.ReadElement(new ServiceSearchModel { Id = serviceId });
|
||||
if (elem == null)
|
||||
return null;
|
||||
return Tuple.Create(elem, elem.ServiceMedications.Select(x => Tuple.Create(x.Value.Item1.MedicationName, x.Value.Item2)).ToList());
|
||||
return Tuple.Create(elem, elem.ServiceMedications.Select(x => x.Value.MedicationName).ToList());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user