forked from DavidMakarov/StudentEnrollment
44 lines
1.1 KiB
C#
44 lines
1.1 KiB
C#
using StudentEnrollmentContracts.BindingModels;
|
|
using StudentEnrollmentDataModels.Models;
|
|
using System.ComponentModel.DataAnnotations;
|
|
|
|
namespace StudentEnrollmentDatabaseImplement.Models
|
|
{
|
|
public class ExamPoints : IExamPointsModel
|
|
{
|
|
public long Id { get; private set; }
|
|
[Required]
|
|
public int FirstExamPoints { get; private set; }
|
|
[Required]
|
|
public int SecondExamPoints { get; private set; }
|
|
[Required]
|
|
public int ThirdExamPoints { get; private set; }
|
|
public int AddPoints { get; private set; }
|
|
public int Summary { get; private set; }
|
|
public static ExamPoints? Create(ExamPointsBindingModel model)
|
|
{
|
|
if (model == null) {
|
|
return null;
|
|
}
|
|
return new ExamPoints()
|
|
{
|
|
Id = model.Id,
|
|
FirstExamPoints = model.FirstExamPoints,
|
|
SecondExamPoints = model.SecondExamPoints,
|
|
ThirdExamPoints = model.ThirdExamPoints,
|
|
AddPoints = model.AddPoints,
|
|
Summary = model.Summary,
|
|
};
|
|
}
|
|
public void Update(ExamPointsBindingModel model)
|
|
{
|
|
if (model == null)
|
|
{
|
|
return;
|
|
}
|
|
AddPoints = model.AddPoints;
|
|
Summary = model.Summary;
|
|
}
|
|
}
|
|
}
|