Skip to content

Commit eda1d6f

Browse files
committed
ComplaintsFix
ComplaintsFix2
1 parent 1c7ae33 commit eda1d6f

7 files changed

Lines changed: 235 additions & 74 deletions

Data/MedHelpContext.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,10 @@ public MedHelpContext(DbContextOptions<MedHelpContext> options) : base(options)
1616
public DbSet<LastOpenedDocument> LastOpenedDocuments { get; set; }
1717
public DbSet<Template> Templates { get; set; }
1818
public DbSet<Medicine> Medicines { get; set; }
19-
public DbSet<Complaint> Complaints { get; set; }
2019
public DbSet<FormModel> FormModels { get; set; }
2120

2221
protected override void OnModelCreating(ModelBuilder modelBuilder)
2322
{
24-
modelBuilder.Entity<ComplaintFormModel>()
25-
.HasKey(t => new { t.ComplaintId, t.FormModelId});
26-
2723
modelBuilder.Entity<MedicineFormModel>()
2824
.HasKey(t => new {t.MedicineId, t.FormModelId});
2925
modelBuilder.Entity<FormModel>()

Migrations/20171212035741_RemoveComplaints.Designer.cs

Lines changed: 159 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
using Microsoft.EntityFrameworkCore.Metadata;
2+
using Microsoft.EntityFrameworkCore.Migrations;
3+
using System;
4+
using System.Collections.Generic;
5+
6+
namespace MedHelp.Migrations
7+
{
8+
public partial class RemoveComplaints : Migration
9+
{
10+
protected override void Up(MigrationBuilder migrationBuilder)
11+
{
12+
migrationBuilder.DropTable(
13+
name: "ComplaintFormModel");
14+
15+
migrationBuilder.DropTable(
16+
name: "Complaints");
17+
18+
migrationBuilder.AddColumn<string>(
19+
name: "Complaints",
20+
table: "FormModels",
21+
nullable: true);
22+
}
23+
24+
protected override void Down(MigrationBuilder migrationBuilder)
25+
{
26+
migrationBuilder.DropColumn(
27+
name: "Complaints",
28+
table: "FormModels");
29+
30+
migrationBuilder.CreateTable(
31+
name: "Complaints",
32+
columns: table => new
33+
{
34+
ComplaintId = table.Column<int>(nullable: false)
35+
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
36+
ComplaintDescription = table.Column<string>(nullable: true)
37+
},
38+
constraints: table =>
39+
{
40+
table.PrimaryKey("PK_Complaints", x => x.ComplaintId);
41+
});
42+
43+
migrationBuilder.CreateTable(
44+
name: "ComplaintFormModel",
45+
columns: table => new
46+
{
47+
ComplaintId = table.Column<int>(nullable: false),
48+
FormModelId = table.Column<int>(nullable: false)
49+
},
50+
constraints: table =>
51+
{
52+
table.PrimaryKey("PK_ComplaintFormModel", x => new { x.ComplaintId, x.FormModelId });
53+
table.ForeignKey(
54+
name: "FK_ComplaintFormModel_Complaints_ComplaintId",
55+
column: x => x.ComplaintId,
56+
principalTable: "Complaints",
57+
principalColumn: "ComplaintId",
58+
onDelete: ReferentialAction.Cascade);
59+
table.ForeignKey(
60+
name: "FK_ComplaintFormModel_FormModels_FormModelId",
61+
column: x => x.FormModelId,
62+
principalTable: "FormModels",
63+
principalColumn: "FormModelId",
64+
onDelete: ReferentialAction.Cascade);
65+
});
66+
67+
migrationBuilder.CreateIndex(
68+
name: "IX_ComplaintFormModel_FormModelId",
69+
table: "ComplaintFormModel",
70+
column: "FormModelId");
71+
}
72+
}
73+
}

Migrations/MedHelpContextModelSnapshot.cs

Lines changed: 2 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -20,38 +20,15 @@ protected override void BuildModel(ModelBuilder modelBuilder)
2020
.HasAnnotation("ProductVersion", "2.0.1-rtm-125")
2121
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
2222

23-
modelBuilder.Entity("MedHelp.Models.Complaint", b =>
24-
{
25-
b.Property<int>("ComplaintId")
26-
.ValueGeneratedOnAdd();
27-
28-
b.Property<string>("ComplaintDescription");
29-
30-
b.HasKey("ComplaintId");
31-
32-
b.ToTable("Complaints");
33-
});
34-
35-
modelBuilder.Entity("MedHelp.Models.ComplaintFormModel", b =>
36-
{
37-
b.Property<int>("ComplaintId");
38-
39-
b.Property<int>("FormModelId");
40-
41-
b.HasKey("ComplaintId", "FormModelId");
42-
43-
b.HasIndex("FormModelId");
44-
45-
b.ToTable("ComplaintFormModel");
46-
});
47-
4823
modelBuilder.Entity("MedHelp.Models.FormModel", b =>
4924
{
5025
b.Property<int>("FormModelId")
5126
.ValueGeneratedOnAdd();
5227

5328
b.Property<string>("Anamnesis");
5429

30+
b.Property<string>("Complaints");
31+
5532
b.Property<string>("DoctorName");
5633

5734
b.Property<DateTime>("PatientBirthday");
@@ -142,19 +119,6 @@ protected override void BuildModel(ModelBuilder modelBuilder)
142119
b.ToTable("Templates");
143120
});
144121

145-
modelBuilder.Entity("MedHelp.Models.ComplaintFormModel", b =>
146-
{
147-
b.HasOne("MedHelp.Models.Complaint", "Complaint")
148-
.WithMany("ComplaintFormModels")
149-
.HasForeignKey("ComplaintId")
150-
.OnDelete(DeleteBehavior.Cascade);
151-
152-
b.HasOne("MedHelp.Models.FormModel", "FormModel")
153-
.WithMany("ComplaintFormModels")
154-
.HasForeignKey("FormModelId")
155-
.OnDelete(DeleteBehavior.Cascade);
156-
});
157-
158122
modelBuilder.Entity("MedHelp.Models.LastOpenedDocument", b =>
159123
{
160124
b.HasOne("MedHelp.Models.FormModel", "FormModel")

Models/Complaint.cs

Lines changed: 0 additions & 15 deletions
This file was deleted.

Models/ComplaintFormModel.cs

Lines changed: 0 additions & 16 deletions
This file was deleted.

Models/FormModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public class FormModel
1212
public DateTime PatientBirthday { get; set; }
1313
public DateTime VisitDay { get; set; }
1414
public ICollection<MedicineFormModel> MedicineFormModels{ get;} = new List<MedicineFormModel>();
15-
public ICollection<ComplaintFormModel> ComplaintFormModels { get; } = new List<ComplaintFormModel>();
15+
public string Complaints { get; set; }
1616
public LastOpenedDocument LastOpenedDocument{ get; set; }
1717
public Template Template { get; set; }
1818
public string Speciality { get; set; }

0 commit comments

Comments
 (0)