CourseWork/University/UniversityContracts/ViewModels/DisciplineViewModel.cs
2024-05-28 19:17:05 +04:00

38 lines
1.3 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Text.Json.Serialization;
using System.Threading.Tasks;
using UniversityDataModels.Models;
namespace UniversityContracts.ViewModels
{
public class DisciplineViewModel : IDisciplineModel
{
public int Id { get; set; }
public int UserId { get; set; }
public int TeacherId { get; set; }
public string TeacherName { get; set; } = string.Empty;
[DisplayName("Название дисциплины")]
public string Name { get; set; } = string.Empty;
[DisplayName("Описание дисциплины")]
public string Description { get; set; } = string.Empty;
[DisplayName("Дата cоздания")]
public DateOnly Date { get; set; } = DateOnly.FromDateTime(DateTime.Now);
public Dictionary<int, IStudentModel> StudentDisciplines
{
get;
set;
} = new();
public DisciplineViewModel() { }
[JsonConstructor]
public DisciplineViewModel(Dictionary<int, StudentViewModel> disciplineStudents) {
this.StudentDisciplines = disciplineStudents.ToDictionary(x => x.Key, x => x.Value as IStudentModel);
}
}
}