30 lines
1.0 KiB
C#
30 lines
1.0 KiB
C#
using SchoolDataModels;
|
|
using System.ComponentModel;
|
|
using System.Text;
|
|
using System.Text.Json.Serialization;
|
|
|
|
namespace SchoolContracts.ViewModels
|
|
{
|
|
public class StudentViewModel : IStudentModel
|
|
{
|
|
public int Id { get; set; }
|
|
public int ExecutorId { get; set; }
|
|
public string ExecutorLogin { get; set; } = string.Empty;
|
|
public string Name { get; set; } = string.Empty;
|
|
public int Course { get; set; }
|
|
|
|
[JsonIgnore]
|
|
public List<DisciplineViewModel> Disciplines { get; set; } = new();
|
|
public override string ToString()
|
|
{
|
|
var result = new StringBuilder();
|
|
foreach (var discipline in Disciplines)
|
|
{
|
|
result.Append($"Ученик {Name} {Course} класса, записанный {discipline.StudentModel[Id].DateOfStudent.ToShortDateString()}, " +
|
|
$"на занятие {discipline.Name}.\n");
|
|
}
|
|
return result.ToString();
|
|
}
|
|
}
|
|
}
|