private void UpdateProperty(string prop) { if (prop == nameof(DietPlanItem.Mass)) { TotalMass = Diet.Sum(x => x.Mass); } if (prop == nameof(DietPlanItem.Energy)) { TotalEnergy = Diet.Sum(x => x.Energy ?? 0.0f); } if (prop == nameof(DietPlanItem.Protein)) { TotalProtein = Diet.Sum(x => x.Protein ?? 0.0f); } if (prop == nameof(DietPlanItem.Sodium)) { TotalSodium = Diet.Sum(x => x.Sodium ?? 0.0f); } if (prop == nameof(DietPlanItem.Cholesterol)) { TotalCholesterol = Diet.Sum(x => x.Cholesterol ?? 0.0f); } if (prop == nameof(DietPlanItem.Fat)) { TotalFat = Diet.Sum(x => x.Fat ?? 0.0f); } if (prop == nameof(DietPlanItem.FattyAcidsMonoUnsaturated)) { TotalFattyAcidsMonoUnsaturated = Diet.Sum(x => x.FattyAcidsMonoUnsaturated ?? 0.0f); } if (prop == nameof(DietPlanItem.FattyAcidsPolyUnsaturated)) { TotalFattyAcidsPolyUnsaturated = Diet.Sum(x => x.FattyAcidsPolyUnsaturated ?? 0.0f); } if (prop == nameof(DietPlanItem.FattyAcidsMonoUnsaturated)) { TotalFattyAcidsMonoUnsaturated = Diet.Sum(x => x.FattyAcidsMonoUnsaturated ?? 0.0f); } if (prop == nameof(DietPlanItem.Carbohydrates)) { TotalCarbohydrates = Diet.Sum(x => x.Carbohydrates ?? 0.0f); } }