Files
vigilcare-clinical/VigilCareClinicalAPI/Domains/Enums/Department.cs
T

35 lines
1.1 KiB
C#

public enum Department
{
Icu,
GeneralMedicine,
Emergency,
Cardiology,
Surgery,
Pediatrics
}
public static class DepartmentExtensions
{
public static string ToDbString(this Department d) => d switch
{
Department.Icu => "ICU",
Department.GeneralMedicine => "GENERAL_MEDICINE",
Department.Emergency => "EMERGENCY",
Department.Cardiology => "CARDIOLOGY",
Department.Surgery => "SURGERY",
Department.Pediatrics => "PEDIATRICS",
_ => throw new ArgumentOutOfRangeException(nameof(d))
};
public static Department FromDbString(string v) => v switch
{
"ICU" => Department.Icu,
"GENERAL_MEDICINE" => Department.GeneralMedicine,
"EMERGENCY" => Department.Emergency,
"CARDIOLOGY" => Department.Cardiology,
"SURGERY" => Department.Surgery,
"PEDIATRICS" => Department.Pediatrics,
_ => throw new ArgumentOutOfRangeException(nameof(v), $"Unknown department: '{v}'")
};
}