Exemplo n.º 1
0
        public void UpdateFoodPerDay(FoodPerDayView foodPerDay)
        {
            var allEntries = new List <FoodEntryEntity>();

            foreach (var entry in foodPerDay.AllFoodEntries)
            {
                var entryEntity = new FoodEntryEntity()
                {
                    Id       = entry.EntryId,
                    FoodId   = entry.FoodId,
                    FoodName = entry.FoodName,
                    Amount   = entry.Amount,
                    Calories = entry.Calories
                };
                allEntries.Add(entryEntity);
            }
            var foodPerDayEntity = new FoodPerDayEntity()
            {
                Id         = foodPerDay.Id,
                Day        = foodPerDay.Day,
                AllEntries = allEntries
            };

            _repoFoodPerDay.Update(foodPerDayEntity);
        }
Exemplo n.º 2
0
        public void AddFoodPerDay(FoodPerDayView foodPerDay)
        {
            var foodPerDayEntity = new FoodPerDayEntity()
            {
                Day = foodPerDay.Day
            };

            _repoFoodPerDay.Add(foodPerDayEntity);
        }