50 lines
1.6 KiB
C#
50 lines
1.6 KiB
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
|
|
namespace InternshipSystem.Core.Entity.Internship
|
|
{
|
|
public class Internship
|
|
{
|
|
public long Id { get; set; }
|
|
public Student Student { get; set; }
|
|
public InternshipRegistration InternshipRegistration { get; set; }
|
|
public Report Report { get; set; }
|
|
public List<Document> Approvals { get; set; }
|
|
public List<Document> Documentation { get; set; }
|
|
|
|
public Edition Edition { get; set; }
|
|
|
|
public float? Grade { 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.Report = Report.Create();
|
|
internship.Approvals = new List<Document>();
|
|
internship.Documentation = new List<Document>();
|
|
|
|
return internship;
|
|
}
|
|
}
|
|
} |