From bdacedddfcaded2638360e9802e2b30724346c36 Mon Sep 17 00:00:00 2001 From: esantangelo <enzo020895@gmail.com> Date: Mon, 7 Dec 2020 21:13:47 -0300 Subject: [PATCH] data layer --- Tsi1.Api/Tsi1.DataLayer/Entities/Activity.cs | 3 --- Tsi1.Api/Tsi1.DataLayer/Entities/Evaluation.cs | 3 +++ Tsi1.Api/Tsi1.DataLayer/Entities/Student.cs | 3 --- .../EntityConfiguration/ActivityConfiguration.cs | 4 ++++ 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Tsi1.Api/Tsi1.DataLayer/Entities/Activity.cs b/Tsi1.Api/Tsi1.DataLayer/Entities/Activity.cs index 7a1bd88..2dcbb58 100644 --- a/Tsi1.Api/Tsi1.DataLayer/Entities/Activity.cs +++ b/Tsi1.Api/Tsi1.DataLayer/Entities/Activity.cs @@ -9,7 +9,6 @@ namespace Tsi1.DataLayer.Entities public Activity() { Attendances = new HashSet<Attendance>(); - Grades = new HashSet<Grade>(); } public int Id { get; set; } @@ -27,7 +26,5 @@ namespace Tsi1.DataLayer.Entities public Evaluation Evaluation { get; set; } public ICollection<Attendance> Attendances { get; set; } - - public ICollection<Grade> Grades { get; set; } } } diff --git a/Tsi1.Api/Tsi1.DataLayer/Entities/Evaluation.cs b/Tsi1.Api/Tsi1.DataLayer/Entities/Evaluation.cs index aa1b5dc..d34c65c 100644 --- a/Tsi1.Api/Tsi1.DataLayer/Entities/Evaluation.cs +++ b/Tsi1.Api/Tsi1.DataLayer/Entities/Evaluation.cs @@ -17,6 +17,9 @@ namespace Tsi1.DataLayer.Entities public bool IsCompleted { get; set; } + + public Activity Activity { get; set; } + public EvaluationType EvaluationType { get; set; } public ICollection<EvaluationInscription> EvaluationInscriptions { get; set; } diff --git a/Tsi1.Api/Tsi1.DataLayer/Entities/Student.cs b/Tsi1.Api/Tsi1.DataLayer/Entities/Student.cs index cc7772d..82d423a 100644 --- a/Tsi1.Api/Tsi1.DataLayer/Entities/Student.cs +++ b/Tsi1.Api/Tsi1.DataLayer/Entities/Student.cs @@ -10,7 +10,6 @@ namespace Tsi1.DataLayer.Entities { StudentCourses = new HashSet<StudentCourse>(); EvaluationInscriptions = new HashSet<EvaluationInscription>(); - Grades = new HashSet<Grade>(); Submissions = new HashSet<Submission>(); } @@ -26,8 +25,6 @@ namespace Tsi1.DataLayer.Entities public User User { get; set; } public ICollection<StudentCourse> StudentCourses { get; set; } - public ICollection<Grade> Grades { get; set; } - public ICollection<EvaluationInscription> EvaluationInscriptions { get; set; } public ICollection<Submission> Submissions { get; set; } diff --git a/Tsi1.Api/Tsi1.DataLayer/EntityConfiguration/ActivityConfiguration.cs b/Tsi1.Api/Tsi1.DataLayer/EntityConfiguration/ActivityConfiguration.cs index bb24098..b967312 100644 --- a/Tsi1.Api/Tsi1.DataLayer/EntityConfiguration/ActivityConfiguration.cs +++ b/Tsi1.Api/Tsi1.DataLayer/EntityConfiguration/ActivityConfiguration.cs @@ -20,6 +20,10 @@ namespace Tsi1.DataLayer.EntityConfiguration builder.HasOne(x => x.Course) .WithMany(x => x.Activities) .HasForeignKey(x => x.CourseId); + + builder.HasOne(x => x.Evaluation) + .WithOne(x => x.Activity) + .HasForeignKey<Activity>(x => x.EvaluationId); } } } -- GitLab