system-praktyk-api/src/InternshipSystem.Core/Entity/Internship/Internship.cs
maxchil 3a2b9b64d5 KEK ()
KEK

Co-authored-by: MaxchilKH <m.w.bohdanowicz@gmail.com>
2020-10-02 21:27:58 +02:00

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;
}
}
}