using System.ComponentModel; namespace StudentProgressRecord.Entity { public class Statement { public long Id { get; set; } [Browsable(false)] public long SubjectId { get; set; } [Browsable(false)] public long TeacherId { get; set; } [DisplayName("Дата")] public DateTime Date { get; set; } [DisplayName("Название предмета")] public string SubjectName { get; set; } = string.Empty; [DisplayName("Преподователь")] public string TeacherName { get; set; } = string.Empty; public IEnumerable Marks { get; private set; } = []; public void SetMarks(IEnumerable marks) { if (marks != null && marks.Any()) { Marks = marks; } } [DisplayName("Оценки")] public string Mark => Marks != null ? string.Join(", ", Marks.Select(x => $"{x.StudentName} {x.Mark}")) : string.Empty; public static Statement CreateOperation(long id, long subjectId, long teacherId, DateTime timeStamp, IEnumerable marks) { return new Statement { Id = id, SubjectId = subjectId, TeacherId = teacherId, Date = timeStamp, Marks = marks }; } } }