CarbonFitness.Data.Model.NutrientRecommendation.GetValue C# (CSharp) Method

GetValue() public method

public GetValue ( string genderName, int age ) : decimal
genderName string
age int
return decimal
        public virtual decimal GetValue(string genderName, int age)
        {
            try {
                GenderNutrientRecommendation genderRecommendation = (from g in GenderRecommendations where g.GenderType.Name == genderName select g).FirstOrDefault();
                if (genderRecommendation == null) {
                    throw new ArgumentNullException("Tried to fetch nutrient recommendation for Nutrient:" + Nutrient.Name + " with gender:" + genderName + " at age:" + age + " but found none.");
                }
                GenderAgeNutrientRecommendation ageRecommendation = genderRecommendation.GetGenderAgeRecommentation(age);

                return ageRecommendation.Value;
            } catch (NullReferenceException n) {
                throw new NullReferenceException("Tried to fetch nutrient recommendation for Nutrient:" + Nutrient.Name + " with gender:" + genderName + " at age:" + age + " but found none.", n);
            }
        }
NutrientRecommendation