ISEbd-22_CourseWork_School/School/SchoolContracts/ViewModels/StudentViewModel.cs

30 lines
1.0 KiB
C#
Raw Permalink Normal View History

2024-05-01 17:54:58 +04:00
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();
}
}
}