53 lines
1.4 KiB
C#
53 lines
1.4 KiB
C#
using EkzamenContracts.BindingModels;
|
|
using EkzamenContracts.ViewModels;
|
|
using EkzamenDataModels;
|
|
|
|
namespace EkzamenListImplement
|
|
{
|
|
public class Student : IStudentModel
|
|
{
|
|
public int Id { get; private set; }
|
|
public static Student? Create(StudentBindingModel? model)
|
|
{
|
|
if (model == null)
|
|
{
|
|
return null;
|
|
}
|
|
return new Student()
|
|
{
|
|
Id = model.Id,
|
|
fio = model.fio,
|
|
DateEnrollment = model.DateEnrollment,
|
|
GroupId = model.GroupId,
|
|
PassMark = model.PassMark,
|
|
RecordBookId = model.RecordBookId,
|
|
};
|
|
}
|
|
public void Update(StudentBindingModel? model)
|
|
{
|
|
if (model == null)
|
|
{
|
|
return;
|
|
}
|
|
|
|
fio = model.fio;
|
|
|
|
}
|
|
public StudentViewModel GetViewModel => new()
|
|
{
|
|
Id = Id,
|
|
fio = fio,
|
|
DateEnrollment = DateEnrollment,
|
|
GroupId = GroupId,
|
|
PassMark = PassMark,
|
|
RecordBookId = RecordBookId,
|
|
|
|
};
|
|
|
|
public string fio { get; set; } = string.Empty;
|
|
public int GroupId { get; set; }
|
|
public int RecordBookId { get; set; }
|
|
public int PassMark { get; set; }
|
|
public DateTime DateEnrollment { get; set; }
|
|
}
|
|
} |