2024-04-28 20:05:31 +04:00
|
|
|
|
using PolyclinicContracts.BindingModels;
|
|
|
|
|
using PolyclinicContracts.ViewModels;
|
|
|
|
|
using PolyclinicDataModels.Models;
|
|
|
|
|
using SecuritySystemDatabaseImplement;
|
|
|
|
|
using System.ComponentModel.DataAnnotations;
|
2024-04-28 16:24:52 +04:00
|
|
|
|
|
|
|
|
|
namespace PolyclinicDatabaseImplement.Models
|
|
|
|
|
{
|
|
|
|
|
public class Medicament : IMedicamentModel
|
|
|
|
|
{
|
2024-04-28 20:05:31 +04:00
|
|
|
|
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; }
|
|
|
|
|
|
2024-04-29 21:10:25 +04:00
|
|
|
|
public virtual Symptom? Symptom { get; set; }
|
|
|
|
|
public virtual Procedure? Procedure { get; set; }
|
|
|
|
|
|
|
|
|
|
public static Medicament Create(MedicamentBindingModel bindingModel)
|
2024-04-28 20:05:31 +04:00
|
|
|
|
{
|
|
|
|
|
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
|
|
|
|
|
};
|
2024-04-28 16:24:52 +04:00
|
|
|
|
}
|
|
|
|
|
}
|