forked from DavidMakarov/StudentEnrollment
38 lines
826 B
C#
38 lines
826 B
C#
|
using StudentEnrollmentContracts.BindingModels;
|
|||
|
using StudentEnrollmentContracts.ViewModels;
|
|||
|
using StudentEnrollmentDataModels.Models;
|
|||
|
using System.ComponentModel.DataAnnotations;
|
|||
|
|
|||
|
namespace StudentEnrollmentDatabaseImplement.Models
|
|||
|
{
|
|||
|
public class Faculty : IFacultyModel
|
|||
|
{
|
|||
|
public long Id { get; private set; }
|
|||
|
[Required]
|
|||
|
public string FacultyName { get; private set;} = string.Empty;
|
|||
|
public static Faculty? Create(FacultyBindingModel model)
|
|||
|
{
|
|||
|
if (model == null)
|
|||
|
return null;
|
|||
|
return new Faculty()
|
|||
|
{
|
|||
|
Id = model.Id,
|
|||
|
FacultyName = model.FacultyName,
|
|||
|
};
|
|||
|
}
|
|||
|
|
|||
|
public void Update(FacultyBindingModel model)
|
|||
|
{
|
|||
|
if (model == null)
|
|||
|
return;
|
|||
|
FacultyName = model.FacultyName;
|
|||
|
}
|
|||
|
|
|||
|
public FacultyViewModel GetViewModel => new()
|
|||
|
{
|
|||
|
Id = Id,
|
|||
|
FacultyName = FacultyName,
|
|||
|
};
|
|||
|
}
|
|||
|
}
|