Beispiel #1
0
 public double CalculateMisc(MiscFood miscFood, double difference)
 {
     if (13 - difference < 0)
     {
         return(0);
     }
     else
     {
         return(Math.Round((13 - difference) * 100 / miscFood.Fiber, 2));
     }
 }
Beispiel #2
0
 public void Generate()
 {
     RandomCarb    = _rawFoodService.GetRandomCarb();
     RandomProtein = _rawFoodService.GetRandomProtein();
     RandomFat     = _rawFoodService.GetRandomFat();
     RandomMisc    = _rawFoodService.GetRandomMisc();
     ProteinName   = RandomProtein.Name;
     FatName       = RandomFat.Name;
     CarbName      = RandomCarb.Name;
     MiscName      = RandomMisc.Name;
     FatAmount     = _rawFoodService.CalculateFat(RandomFat, Calories);
     ProteinAmount = _rawFoodService.CalculateProtein(RandomProtein, Calories, RandomFat.Protein);
     CarbAmount    = _rawFoodService.CalculateCarb(RandomCarb, Calories, RandomFat.Carb + RandomProtein.Carb);
     MiscAmount    = _rawFoodService.CalculateMisc(RandomMisc, CarbAmount * RandomCarb.Fiber / 100 + ProteinAmount * RandomProtein.Fiber / 100 + FatAmount * RandomFat.Fiber / 100);
 }