53 lines
1.4 KiB
C#
53 lines
1.4 KiB
C#
using PolyclinicContracts.BindingModels;
|
|
using PolyclinicContracts.ViewModels;
|
|
using PolyclinicDataModels.Models;
|
|
using SecuritySystemDatabaseImplement;
|
|
using System.ComponentModel.DataAnnotations;
|
|
|
|
namespace PolyclinicDatabaseImplement.Models
|
|
{
|
|
public class Medicament : IMedicamentModel
|
|
{
|
|
public int Id { get; set; }
|
|
|
|
[Required]
|
|
public string Name { get; set; } = string.Empty;
|
|
|
|
[Required]
|
|
public string Comment { get; set; } = string.Empty;
|
|
|
|
[Required]
|
|
public int ProcedureId { get; set; }
|
|
|
|
[Required]
|
|
public int SymptomId { get; set; }
|
|
|
|
public static Medicament Create(PolyclinicDatabase database, MedicamentBindingModel bindingModel)
|
|
{
|
|
return new Medicament()
|
|
{
|
|
Id = bindingModel.Id,
|
|
Name = bindingModel.Name,
|
|
Comment = bindingModel.Comment,
|
|
ProcedureId = bindingModel.ProcedureId,
|
|
SymptomId = bindingModel.SymptomId
|
|
};
|
|
}
|
|
|
|
public void Update(MedicamentBindingModel bindingModel)
|
|
{
|
|
Name = bindingModel.Name;
|
|
Comment = bindingModel.Comment;
|
|
}
|
|
|
|
public MedicamentViewModel GetViewModel => new()
|
|
{
|
|
Id = Id,
|
|
Name = Name,
|
|
Comment = Comment,
|
|
ProcedureId = ProcedureId,
|
|
SymptomId = SymptomId
|
|
};
|
|
}
|
|
}
|