64 lines
1.8 KiB
C#
64 lines
1.8 KiB
C#
using AutomobilePlantContracts.BindingModels;
|
|
using AutomobilePlantContracts.ViewModel;
|
|
using AutomobilePlantDataModels.Models;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace AutomobilePlantDataBaseImplements.Models
|
|
{
|
|
public class Implementer : IImplementerModel
|
|
{
|
|
public int Id { get; set; }
|
|
|
|
[Required]
|
|
public string ImplementerFIO { get; set; } = string.Empty;
|
|
|
|
[Required]
|
|
public int WorkExperience { get; set; }
|
|
[Required]
|
|
public int Qualification { get; set; }
|
|
|
|
[Required]
|
|
public string Password { get; set; } = string.Empty;
|
|
|
|
|
|
[ForeignKey("ImplementerId")]
|
|
public virtual List<Order> Orders { get; set; } = new();
|
|
|
|
public static Implementer Create(ImplementerBindingModel model)
|
|
{
|
|
return new Implementer()
|
|
{
|
|
Id = model.Id,
|
|
ImplementerFIO = model.ImplementerFIO,
|
|
WorkExperience = model.WorkExperience,
|
|
Qualification = model.Qualification,
|
|
Password = model.Password
|
|
};
|
|
}
|
|
|
|
public void Update(ImplementerBindingModel model)
|
|
{
|
|
ImplementerFIO = model.ImplementerFIO;
|
|
WorkExperience=model.WorkExperience;
|
|
Qualification=model.Qualification;
|
|
Password = model.Password;
|
|
}
|
|
|
|
public ImplementerViewModel GetViewModel => new()
|
|
{
|
|
Id = Id,
|
|
ImplementerFIO = ImplementerFIO,
|
|
WorkExperience = WorkExperience,
|
|
Qualification=Qualification,
|
|
Password = Password
|
|
};
|
|
|
|
}
|
|
}
|