diff --git a/Polyclinic/PolyclinicContracts/BindingModels/MedicamentBindingModel.cs b/Polyclinic/PolyclinicContracts/BindingModels/MedicamentBindingModel.cs index 6840e73..a53cfdb 100644 --- a/Polyclinic/PolyclinicContracts/BindingModels/MedicamentBindingModel.cs +++ b/Polyclinic/PolyclinicContracts/BindingModels/MedicamentBindingModel.cs @@ -5,11 +5,9 @@ namespace PolyclinicContracts.BindingModels public class MedicamentBindingModel : IMedicamentModel { public int Id { get; set; } - public int SymptomId { get; set; } + public int? SymptomId { get; set; } public int ProcedureId { get; set; } public string Name { get; set; } = string.Empty; public string Comment { get; set; } = string.Empty; - public Dictionary MedicamentSymptomes { get; set; } = new(); - public Dictionary MedicamentProcedures { get; set; } = new(); } } \ No newline at end of file diff --git a/Polyclinic/PolyclinicContracts/BindingModels/RecipeBindingModel.cs b/Polyclinic/PolyclinicContracts/BindingModels/RecipeBindingModel.cs index a8fb036..1e92b18 100644 --- a/Polyclinic/PolyclinicContracts/BindingModels/RecipeBindingModel.cs +++ b/Polyclinic/PolyclinicContracts/BindingModels/RecipeBindingModel.cs @@ -5,7 +5,7 @@ namespace PolyclinicContracts.BindingModels public class RecipeBindingModel : IRecipeModel { public int Id { get; set; } - public int CourseId { get; set; } + public int? CourseId { get; set; } public int ProceduresCount { get; set; } public string Comment { get; set; } = string.Empty; public Dictionary RecipeProcedures { get; } = new(); diff --git a/Polyclinic/PolyclinicContracts/ViewModels/MedicamentViewModel.cs b/Polyclinic/PolyclinicContracts/ViewModels/MedicamentViewModel.cs index 64f8aba..516bfa1 100644 --- a/Polyclinic/PolyclinicContracts/ViewModels/MedicamentViewModel.cs +++ b/Polyclinic/PolyclinicContracts/ViewModels/MedicamentViewModel.cs @@ -7,7 +7,7 @@ namespace PolyclinicContracts.ViewModels { public int Id { get; set; } public int ProcedureId { get; set; } - public int SymptomId { get; set; } + public int? SymptomId { get; set; } [DisplayName("Название медикамента")] public string Name { get; set; } = string.Empty; [DisplayName("Комментарий")] diff --git a/Polyclinic/PolyclinicContracts/ViewModels/RecipeViewModel.cs b/Polyclinic/PolyclinicContracts/ViewModels/RecipeViewModel.cs index 3aae688..cd8a8b2 100644 --- a/Polyclinic/PolyclinicContracts/ViewModels/RecipeViewModel.cs +++ b/Polyclinic/PolyclinicContracts/ViewModels/RecipeViewModel.cs @@ -12,7 +12,7 @@ namespace PolyclinicContracts.ViewModels [DisplayName("Комментарий")] public string Comment { get; set; } = string.Empty; - public int CourseId { get; set; } + public int? CourseId { get; set; } public Dictionary RecipeProcedures { get; } = new(); } } diff --git a/Polyclinic/PolyclinicDataModels/Models/IMedicamentModel.cs b/Polyclinic/PolyclinicDataModels/Models/IMedicamentModel.cs index e865b50..9e7d161 100644 --- a/Polyclinic/PolyclinicDataModels/Models/IMedicamentModel.cs +++ b/Polyclinic/PolyclinicDataModels/Models/IMedicamentModel.cs @@ -5,6 +5,6 @@ string Name { get; } string Comment { get; } int ProcedureId { get; } - int SymptomId { get; } + int? SymptomId { get; } } } \ No newline at end of file diff --git a/Polyclinic/PolyclinicDataModels/Models/IRecipeModel.cs b/Polyclinic/PolyclinicDataModels/Models/IRecipeModel.cs index 46a0d90..486c702 100644 --- a/Polyclinic/PolyclinicDataModels/Models/IRecipeModel.cs +++ b/Polyclinic/PolyclinicDataModels/Models/IRecipeModel.cs @@ -4,7 +4,7 @@ { int ProceduresCount { get; set; } string Comment { get; set; } - int CourseId { get; set; } + int? CourseId { get; set; } Dictionary RecipeProcedures { get; } } } \ No newline at end of file diff --git a/Polyclinic/PolyclinicDatabaseImplement/Migrations/20240430185032_InitDatabase.Designer.cs b/Polyclinic/PolyclinicDatabaseImplement/Migrations/20240430202621_InitCreate.Designer.cs similarity index 97% rename from Polyclinic/PolyclinicDatabaseImplement/Migrations/20240430185032_InitDatabase.Designer.cs rename to Polyclinic/PolyclinicDatabaseImplement/Migrations/20240430202621_InitCreate.Designer.cs index 6f641fe..4e08915 100644 --- a/Polyclinic/PolyclinicDatabaseImplement/Migrations/20240430185032_InitDatabase.Designer.cs +++ b/Polyclinic/PolyclinicDatabaseImplement/Migrations/20240430202621_InitCreate.Designer.cs @@ -1,4 +1,5 @@ // +using System; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; @@ -11,8 +12,8 @@ using SecuritySystemDatabaseImplement; namespace PolyclinicDatabaseImplement.Migrations { [DbContext(typeof(PolyclinicDatabase))] - [Migration("20240430185032_InitDatabase")] - partial class InitDatabase + [Migration("20240430202621_InitCreate")] + partial class InitCreate { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) @@ -115,7 +116,8 @@ namespace PolyclinicDatabaseImplement.Migrations b.Property("ProcedureId") .HasColumnType("int"); - b.Property("SymptomId") + b.Property("SymptomId") + .IsRequired() .HasColumnType("int"); b.HasKey("Id"); @@ -163,7 +165,7 @@ namespace PolyclinicDatabaseImplement.Migrations .IsRequired() .HasColumnType("nvarchar(max)"); - b.Property("CourseId") + b.Property("CourseId") .HasColumnType("int"); b.Property("ProceduresCount") @@ -347,9 +349,7 @@ namespace PolyclinicDatabaseImplement.Migrations { b.HasOne("PolyclinicDatabaseImplement.Models.Course", "Course") .WithMany() - .HasForeignKey("CourseId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); + .HasForeignKey("CourseId"); b.Navigation("Course"); }); diff --git a/Polyclinic/PolyclinicDatabaseImplement/Migrations/20240430185032_InitDatabase.cs b/Polyclinic/PolyclinicDatabaseImplement/Migrations/20240430202621_InitCreate.cs similarity index 98% rename from Polyclinic/PolyclinicDatabaseImplement/Migrations/20240430185032_InitDatabase.cs rename to Polyclinic/PolyclinicDatabaseImplement/Migrations/20240430202621_InitCreate.cs index 44b77cf..47840e0 100644 --- a/Polyclinic/PolyclinicDatabaseImplement/Migrations/20240430185032_InitDatabase.cs +++ b/Polyclinic/PolyclinicDatabaseImplement/Migrations/20240430202621_InitCreate.cs @@ -5,7 +5,7 @@ namespace PolyclinicDatabaseImplement.Migrations { /// - public partial class InitDatabase : Migration + public partial class InitCreate : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) @@ -78,7 +78,7 @@ namespace PolyclinicDatabaseImplement.Migrations .Annotation("SqlServer:Identity", "1, 1"), ProceduresCount = table.Column(type: "int", nullable: false), Comment = table.Column(type: "nvarchar(max)", nullable: false), - CourseId = table.Column(type: "int", nullable: false) + CourseId = table.Column(type: "int", nullable: true) }, constraints: table => { @@ -87,8 +87,7 @@ namespace PolyclinicDatabaseImplement.Migrations name: "FK_Recipes_Courses_CourseId", column: x => x.CourseId, principalTable: "Courses", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); + principalColumn: "Id"); }); migrationBuilder.CreateTable( diff --git a/Polyclinic/PolyclinicDatabaseImplement/Migrations/PolyclinicDatabaseModelSnapshot.cs b/Polyclinic/PolyclinicDatabaseImplement/Migrations/PolyclinicDatabaseModelSnapshot.cs index a4e4364..0f268d6 100644 --- a/Polyclinic/PolyclinicDatabaseImplement/Migrations/PolyclinicDatabaseModelSnapshot.cs +++ b/Polyclinic/PolyclinicDatabaseImplement/Migrations/PolyclinicDatabaseModelSnapshot.cs @@ -1,4 +1,5 @@ // +using System; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; @@ -112,7 +113,8 @@ namespace PolyclinicDatabaseImplement.Migrations b.Property("ProcedureId") .HasColumnType("int"); - b.Property("SymptomId") + b.Property("SymptomId") + .IsRequired() .HasColumnType("int"); b.HasKey("Id"); @@ -160,7 +162,7 @@ namespace PolyclinicDatabaseImplement.Migrations .IsRequired() .HasColumnType("nvarchar(max)"); - b.Property("CourseId") + b.Property("CourseId") .HasColumnType("int"); b.Property("ProceduresCount") @@ -344,9 +346,7 @@ namespace PolyclinicDatabaseImplement.Migrations { b.HasOne("PolyclinicDatabaseImplement.Models.Course", "Course") .WithMany() - .HasForeignKey("CourseId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); + .HasForeignKey("CourseId"); b.Navigation("Course"); }); diff --git a/Polyclinic/PolyclinicDatabaseImplement/Models/Medicament.cs b/Polyclinic/PolyclinicDatabaseImplement/Models/Medicament.cs index 9e1b33b..1e01374 100644 --- a/Polyclinic/PolyclinicDatabaseImplement/Models/Medicament.cs +++ b/Polyclinic/PolyclinicDatabaseImplement/Models/Medicament.cs @@ -20,7 +20,7 @@ namespace PolyclinicDatabaseImplement.Models public int ProcedureId { get; set; } [Required] - public int SymptomId { get; set; } + public int? SymptomId { get; set; } public virtual Symptom? Symptom { get; set; } public virtual Procedure? Procedure { get; set; } @@ -49,7 +49,7 @@ namespace PolyclinicDatabaseImplement.Models Name = Name, Comment = Comment, ProcedureId = ProcedureId, - SymptomId = SymptomId + SymptomId = Symptom?.Id ?? null }; } } diff --git a/Polyclinic/PolyclinicDatabaseImplement/Models/Recipe.cs b/Polyclinic/PolyclinicDatabaseImplement/Models/Recipe.cs index 87c0761..bf3a0c4 100644 --- a/Polyclinic/PolyclinicDatabaseImplement/Models/Recipe.cs +++ b/Polyclinic/PolyclinicDatabaseImplement/Models/Recipe.cs @@ -16,7 +16,7 @@ namespace PolyclinicDatabaseImplement.Models [Required] public string Comment { get; set; } = string.Empty; - public int CourseId { get; set; } + public int? CourseId { get; set; } public virtual Course Course { get; set; } = new(); private Dictionary? _recipeProcedures = null; @@ -64,7 +64,7 @@ namespace PolyclinicDatabaseImplement.Models Id = Id, ProceduresCount = ProceduresCount, Comment = Comment, - CourseId = CourseId, + CourseId = Course?.Id ?? null, }; public void UpdateProcedures(PolyclinicDatabase database, RecipeBindingModel bindingModel) diff --git a/Polyclinic/PolyclinicDatabaseImplement/PolyclinicDatabaseImplement.csproj b/Polyclinic/PolyclinicDatabaseImplement/PolyclinicDatabaseImplement.csproj index 6a1d280..a1d7582 100644 --- a/Polyclinic/PolyclinicDatabaseImplement/PolyclinicDatabaseImplement.csproj +++ b/Polyclinic/PolyclinicDatabaseImplement/PolyclinicDatabaseImplement.csproj @@ -20,8 +20,4 @@ - - - - diff --git a/Polyclinic/PolyclinicWebAppSuretor/PolyclinicWebAppSuretor.csproj b/Polyclinic/PolyclinicWebAppSuretor/PolyclinicWebAppSuretor.csproj index 4eda501..c39167e 100644 --- a/Polyclinic/PolyclinicWebAppSuretor/PolyclinicWebAppSuretor.csproj +++ b/Polyclinic/PolyclinicWebAppSuretor/PolyclinicWebAppSuretor.csproj @@ -6,6 +6,13 @@ enable + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + diff --git a/Polyclinic/PolyclinicWebAppSuretor/Views/Home/CreateRecipe.cshtml b/Polyclinic/PolyclinicWebAppSuretor/Views/Home/CreateRecipe.cshtml index 8beebaf..4549813 100644 --- a/Polyclinic/PolyclinicWebAppSuretor/Views/Home/CreateRecipe.cshtml +++ b/Polyclinic/PolyclinicWebAppSuretor/Views/Home/CreateRecipe.cshtml @@ -15,22 +15,41 @@

Количество процедур:

- +

Комментарий:

-
-
- + + @{ + int countCourse = 10; + for (int i = 0; i < countCourse; i++) + { + + } + } + +
*@ + +
+

+ Выбор процедуры: +

+