60 lines
1.7 KiB
C#
60 lines
1.7 KiB
C#
using HospitalContracts.BindingModels;
|
|
using HospitalContracts.ViewModels;
|
|
using HospitalDataModels.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 HospitalDataBaseImplements.Models
|
|
{
|
|
public class Symptoms : ISymptomsModel
|
|
{
|
|
public int Id { get; private set; }
|
|
[Required]
|
|
public string SymptomName { get; set; } = string.Empty;
|
|
public string? Description { get; set; } = string.Empty;
|
|
public virtual List<IllnessSymptoms> IllnessSymptomses { get; set; } = new();
|
|
public static Symptoms? Create(SymptomsBindingModel model)
|
|
{
|
|
if (model == null)
|
|
{
|
|
return null;
|
|
}
|
|
return new Symptoms()
|
|
{
|
|
Id = model.Id,
|
|
SymptomName = model.SymptomName,
|
|
Description = model.Description
|
|
};
|
|
}
|
|
public static Symptoms Create(SymptomsViewModel model)
|
|
{
|
|
return new Symptoms
|
|
{
|
|
Id = model.Id,
|
|
SymptomName = model.SymptomName,
|
|
Description = model.Description
|
|
};
|
|
}
|
|
public void Update(SymptomsBindingModel model)
|
|
{
|
|
if (model == null)
|
|
{
|
|
return;
|
|
}
|
|
SymptomName = model.SymptomName;
|
|
Description = model.Description;
|
|
}
|
|
public SymptomsViewModel GetViewModel => new()
|
|
{
|
|
Id = Id,
|
|
SymptomName = SymptomName,
|
|
Description = Description
|
|
};
|
|
}
|
|
}
|