ISEbd-22_CourseWork_School/School/SchoolDataBaseImplement/Models/Implementer.cs

35 lines
1.1 KiB
C#
Raw Normal View History

2024-05-01 17:54:58 +04:00
using SchoolContracts.BindingModels;
using SchoolContracts.Extensions;
using SchoolContracts.ViewModels;
using SchoolDataModels;
using System.ComponentModel.DataAnnotations;
namespace SchoolDatabaseImplement.Models
{
public class Implementer : IImplementerModel
{
public int Id { get; set; }
[Required]
public string FirstName { get; private set; } = string.Empty;
[Required]
public string LastName { get; private set; } = string.Empty;
[Required]
public string Login { get; private set; } = string.Empty;
[Required]
public string Password { get; private set; } = string.Empty;
public string PhoneNumber { get; set; } = string.Empty;
[Required]
public List<Discipline>? Disciplines { get; private set; }
public static Implementer Create(ImplementerBindingModel model)
{
return model.CastWithCommonProperties<Implementer, ImplementerBindingModel>();
}
public static implicit operator ImplementerViewModel?(Implementer? model) => model?.CastWithCommonProperties<ImplementerViewModel, Implementer>();
}
}