58 lines
1.5 KiB
C#
58 lines
1.5 KiB
C#
using System.ComponentModel.DataAnnotations;
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
using System.Text.RegularExpressions;
|
|
using EkzamenContracts.BindingModels;
|
|
using EkzamenContracts.ViewModels;
|
|
using EkzamenDataModels;
|
|
|
|
namespace EkzamenDatabaseImplement
|
|
{
|
|
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; }
|
|
public int GroupId { get; set; }
|
|
public int RecordBookId { get; set; }
|
|
public int PassMark { get; set; }
|
|
public DateTime DateEnrollment { get; set; }
|
|
|
|
public Group Group { get; set; }
|
|
}
|
|
}
|