Ejemplo n.º 1
0
        public static string GetEnumDescription(this EnumIngrediente value)
        {
            FieldInfo fi = value.GetType( ).GetField(value.ToString( ));

            DescriptionAttribute[] attributes = ( DescriptionAttribute[] )fi.GetCustomAttributes(typeof(DescriptionAttribute), false);

            if (attributes != null && attributes.Length > 0)
            {
                return(attributes[0].Description);
            }
            else
            {
                return(value.ToString( ));
            }
        }
 public Ingrediente GetById(EnumIngrediente p_Ingrediente)
 {
     return(GetAll( ).Where(w => w.Id == p_Ingrediente).FirstOrDefault( ));
 }