public void LoadFamilyNutritionFoodRelation(FamilyNutrition familyNutrition) { if (familyNutrition?.FamilyNutritionFoodRelation == null || familyNutrition.FamilyNutritionFoodRelation.Length == 0) { return; } var frequencies = new List <Frequency>(); foreach (var iter in familyNutrition.FamilyNutritionFoodRelation) { frequencies.Add(new Frequency() { Id = iter.FrequencyId, Name = Frequencies.Where(f => f.Id == iter.FrequencyId).FirstOrDefault()?.Name }); } FrequencyIdsSelected = frequencies.ToArray(); }
public ApiFrequency GetFrequency(int id) { return(Frequencies.Where(x => x.Id == id).FirstOrDefault()); }