/// <summary> /// Add intake to the DietaryComponents list /// </summary> /// <param name="dietComponent"></param> public void AddIntake(LabourDietComponent dietComponent) { if (DietaryComponentList == null) { DietaryComponentList = new List <LabourDietComponent>(); } LabourDietComponent alreadyEaten = DietaryComponentList.Where(a => a.FoodStore != null && a.FoodStore.Name == dietComponent.FoodStore.Name).FirstOrDefault(); if (alreadyEaten != null) { alreadyEaten.AmountConsumed += dietComponent.AmountConsumed; } else { DietaryComponentList.Add(dietComponent); } }