public enum BloodType
{
    APositive,
    ANegative,
    BPositive,
    BNegative,
    AbPositive,
    AbNegative,
    OPositive,
    ONegative
}

public static class BloodTypeExtensions
{
    public static string ToDbString(this BloodType b) => b switch
    {
        BloodType.APositive  => "A+",
        BloodType.ANegative  => "A-",
        BloodType.BPositive  => "B+",
        BloodType.BNegative  => "B-",
        BloodType.AbPositive => "AB+",
        BloodType.AbNegative => "AB-",
        BloodType.OPositive  => "O+",
        BloodType.ONegative  => "O-",
        _ => throw new ArgumentOutOfRangeException(nameof(b))
    };

    public static BloodType FromDbString(string v) => v switch
    {
        "A+"  => BloodType.APositive,
        "A-"  => BloodType.ANegative,
        "B+"  => BloodType.BPositive,
        "B-"  => BloodType.BNegative,
        "AB+" => BloodType.AbPositive,
        "AB-" => BloodType.AbNegative,
        "O+"  => BloodType.OPositive,
        "O-"  => BloodType.ONegative,
        _ => throw new ArgumentOutOfRangeException(nameof(v), $"Unknown blood type: '{v}'")
    };
}
