Пример #1
0
        /// <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);
            }
        }
Пример #2
0
        /// <summary>
        /// Add intake to the DietaryComponents list
        /// </summary>
        /// <param name="request"></param>
        public void AddIntake(ResourceRequest request)
        {
            if (DietaryComponentList == null)
            {
                DietaryComponentList = new List <ResourceRequest>();
            }
            ResourceRequest alreadyEaten = DietaryComponentList.Where(a => a.ResourceTypeName == request.ResourceTypeName).FirstOrDefault();

            if (alreadyEaten != null)
            {
                alreadyEaten.Provided += request.Provided;
            }
            else
            {
                DietaryComponentList.Add(request);
            }
        }