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

42 lines
1.7 KiB
C#
Raw Normal View History

2024-05-01 17:54:58 +04:00
using SchoolDataModels;
using System.ComponentModel;
using System.Text;
using SchoolDataModels.Models;
namespace SchoolContracts.ViewModels
{
public class DisciplineViewModel : IDisciplineModel
{
public int Id { get; set; }
public int ImplementerId { get; set; }
public string Name { get; set; } = string.Empty;
public double Price { get; set; }
[DisplayName("Логин ученика")]
public string ExecutorLogin { get; set; } = string.Empty;
[DisplayName("Дата получения")]
public DateOnly DateOfReceipt { get; set; } = DateOnly.FromDateTime(DateTime.Now);
[DisplayName("Дата прохождения")]
public DateOnly DateOfPassage { get; set; } = DateOnly.FromDateTime(DateTime.Now);
public Dictionary<int, StudentByDisciplineModel> StudentsModel { get; set; } = new();
public List<RequirementViewModel> RequirementViewModels { get; set; } = new();
public List<StudentViewModel> StudentViewModels { get; set; } = new();
public override string ToString()
{
var result = new StringBuilder(
$"Занятие {Name}, созданная {DateOfReceipt}, " +
$"дата обучения {DateOfPassage}, включает в себя группу учеников:");
for (int i = 0; i < StudentViewModels.Count; i++)
{
var discipline = StudentViewModels[i];
result.Append($"\n\t{i + 1}. {discipline.Name} на " +
$"{StudentsModel[discipline.Id].DateOfStudent.ToShortDateString()}");
}
return result.ToString();
}
}
}