using PolyclinicContracts.BindingModels; using PolyclinicContracts.ViewModels; using PolyclinicDataModels.Models; using SecuritySystemDatabaseImplement; using System.ComponentModel.DataAnnotations; namespace PolyclinicDatabaseImplement.Models { public class Procedure : IProcedureModel { public int Id { get; set; } [Required] public int UserId { get; set; } [Required] public string Name { get; set; } = string.Empty; [Required] public string Comment { get; set; } = string.Empty; public static Procedure Create(ProcedureBindingModel bindingModel) { return new Procedure() { Id = bindingModel.Id, UserId = bindingModel.UserId, Name = bindingModel.Name, Comment = bindingModel.Comment, }; } public void Update(ProcedureBindingModel bindingModel) { Name = bindingModel.Name; Comment = bindingModel.Comment; } public ProcedureViewModel GetViewModel => new() { Id = Id, Name = Name, UserId = UserId, Comment = Comment, }; } }