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

33 lines
1.2 KiB
C#

using SchoolContracts.BindingModels;
using SchoolContracts.ViewModels;
using SchoolDataModels;
using System.ComponentModel.DataAnnotations;
using SchoolContracts.Extensions;
namespace SchoolDatabaseImplement.Models
{
public class Executor : IExecutorModel
{
public int Id { get; private 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<Student>? Students { get; private set; }
[Required]
public List<Requirement>? Requirements { get; private set; }
public static Executor Create(ExecutorBindingModel model) => model.CastWithCommonProperties<Executor, ExecutorBindingModel>();
public static implicit operator ExecutorViewModel?(Executor? model) => model?.CastWithCommonProperties<ExecutorViewModel, Executor>();
}
}