using System.Collections.Generic; using System.Linq; namespace InternshipSystem.Core { public class Internship { public long Id { get; set; } public Student Student { get; set; } public InternshipRegistration InternshipRegistration { get; set; } public InternshipProgram InternshipProgram { get; set; } public Report Report { get; set; } public List Approvals { get; set; } public List Documentation { get; set; } public float? Grade { get; set; } public Edition Edition { get; set; } public void UpdateDocument(Document document) { var oldDocument = Documentation.First(d => d.Id == document.Id); oldDocument.Description = document.Description ?? oldDocument.Description; oldDocument.Scan = document.Scan ?? oldDocument.Scan; oldDocument.Type = document.Type; oldDocument.State = DocumentState.Submitted; } public void AddNewDocument(Document document) { document.State = DocumentState.Submitted; Documentation.Add(document); } public static Internship CreateStudentsInternship(Student student) { var internship = new Internship(); internship.Student = student; internship.InternshipRegistration = InternshipRegistration.Create(); internship.InternshipProgram = InternshipProgram.Create(); internship.Report = Report.Create(); internship.Approvals = new List(); internship.Documentation = new List(); return internship; } } }