Exemple #1
0
 public static string ToString(PatientDiet value)
 {
     if (value == PatientDiet.Vegetarian)
     {
         return("vegetarian");
     }
     else if (value == PatientDiet.DiaryFree)
     {
         return("diary-free");
     }
     else if (value == PatientDiet.NutFree)
     {
         return("nut-free");
     }
     else if (value == PatientDiet.GlutenFree)
     {
         return("gluten-free");
     }
     else if (value == PatientDiet.Vegan)
     {
         return("vegan");
     }
     else if (value == PatientDiet.Halal)
     {
         return("halal");
     }
     else if (value == PatientDiet.Kosher)
     {
         return("kosher");
     }
     else
     {
         throw new ArgumentException("Unrecognized PatientDiet value: " + value.ToString());
     }
 }
Exemple #2
0
            public static bool TryParse(string value, out PatientDiet result)
            {
                result = default(PatientDiet);

                if (value == "vegetarian")
                {
                    result = PatientDiet.Vegetarian;
                }
                else if (value == "diary-free")
                {
                    result = PatientDiet.DiaryFree;
                }
                else if (value == "nut-free")
                {
                    result = PatientDiet.NutFree;
                }
                else if (value == "gluten-free")
                {
                    result = PatientDiet.GlutenFree;
                }
                else if (value == "vegan")
                {
                    result = PatientDiet.Vegan;
                }
                else if (value == "halal")
                {
                    result = PatientDiet.Halal;
                }
                else if (value == "kosher")
                {
                    result = PatientDiet.Kosher;
                }
                else
                {
                    return(false);
                }

                return(true);
            }