50 lines
1.2 KiB
C#
50 lines
1.2 KiB
C#
using ConstructionFirmDataModels.Models;
|
|
using Subd_4.BindingModels;
|
|
using Subd_4.ViewModels;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace ConstructionFirmDatabaseImplement.Models
|
|
{
|
|
public class Specialty : ISpecialtyModel
|
|
{
|
|
public int Id { get; set; }
|
|
|
|
[Required]
|
|
public string SpecialtyName { get; set; } = string.Empty;
|
|
|
|
[Required]
|
|
public int Salary { get; set; }
|
|
|
|
public static Specialty? Create(SpecialtyBindingModel model)
|
|
{
|
|
if (model == null) return null;
|
|
|
|
return new Specialty()
|
|
{
|
|
Id = model.Id,
|
|
SpecialtyName = model.SpecialtyName,
|
|
Salary = model.Salary
|
|
};
|
|
}
|
|
|
|
public void Update(SpecialtyBindingModel model)
|
|
{
|
|
if (model == null) return;
|
|
SpecialtyName = model.SpecialtyName;
|
|
Salary = model.Salary;
|
|
}
|
|
|
|
public SpecialtyViewModel GetViewModel => new()
|
|
{
|
|
Id = Id,
|
|
SpecialtyName = SpecialtyName,
|
|
Salary = Salary
|
|
};
|
|
}
|
|
}
|