diff --git a/src/InternshipSystem.Api/Controllers/ReportController.cs b/src/InternshipSystem.Api/Controllers/ReportController.cs index 0427641..e2b121d 100644 --- a/src/InternshipSystem.Api/Controllers/ReportController.cs +++ b/src/InternshipSystem.Api/Controllers/ReportController.cs @@ -34,7 +34,8 @@ namespace InternshipSystem.Api.Controllers .SingleAsync(i => i.Student.Id == user.PersonNumber, ct); internship.Report.UpdateReport(reportValue.ToString(Formatting.None)); - + internship.AddInternshipEvaluation(); + await _context.SaveChangesAsync(ct); return Ok(); diff --git a/src/InternshipSystem.Core/Entity/Internship/Internship.cs b/src/InternshipSystem.Core/Entity/Internship/Internship.cs index ddfcf9b..84334a3 100644 --- a/src/InternshipSystem.Core/Entity/Internship/Internship.cs +++ b/src/InternshipSystem.Core/Entity/Internship/Internship.cs @@ -53,5 +53,22 @@ namespace InternshipSystem.Core.Entity.Internship // document.Scan = documentScan; // document.State = DocumentState.Submitted; } + + public void AddInternshipEvaluation() + { + if (Documentation.Any(d => d.Type == DocumentType.InternshipEvaluation)) + { + return; + } + + var document = new Document + { + Description = "", + Type = DocumentType.InternshipEvaluation, + State = DocumentState.Draft + }; + + Documentation.Add(document); + } } } \ No newline at end of file diff --git a/src/InternshipSystem.Core/ValueObject/DocumentType.cs b/src/InternshipSystem.Core/ValueObject/DocumentType.cs index 24f8f10..3651c43 100644 --- a/src/InternshipSystem.Core/ValueObject/DocumentType.cs +++ b/src/InternshipSystem.Core/ValueObject/DocumentType.cs @@ -4,6 +4,7 @@ { IppScan, DeanConsent, - NnwIsurance + NnwIsurance, + InternshipEvaluation } } \ No newline at end of file