20 lines
547 B
C#
Raw Permalink Normal View History

using System.ComponentModel;
namespace MedicalDatabaseContracts.Models
{
public class Patient : AbstractPersonModel
{
public string Gender { get; set; } = string.Empty;
public DateTime Birthday { get; set; }
public int Weight { get; set; }
public int Height { get; set; }
2024-05-19 16:31:22 +04:00
public int GetAge()
{
var today = DateTime.Today;
int age = today.Year - Birthday.Year;
if (Birthday.Date > today.AddYears(-age)) age--;
return age;
}
}
}