Ejemplo n.º 1
0
 public void PutCustomDay(CustomDay customDay)
 {
     if (customDay.Calories < 0)
     {
         throw new Exception("You can't eat less than 0 calories, adding training will be available in future releases.");
     }
     if (CustomDays.Where(d => d.Date.Date == customDay.Date.Date).Any())
     {
         _customDays.Single(d => d.Date.Date == customDay.Date.Date).SetCalories(customDay.Calories);
     }
     else
     {
         _customDays.Add(customDay);
     }
 }
Ejemplo n.º 2
0
        public void AddCustomDay(CustomDay customDay)
        {
            if (customDay.Calories < 0)
            {
                throw new Exception("You can't eat less than 0 calories, adding training will be available in future releases.");
            }

            if (CustomDays.Where(d => d.Date.Date == customDay.Date.Date).Any())
            {
                throw new Exception($"This day has already been added for user with id {UserId}.");
            }
            else
            {
                _customDays.Add(customDay);
            }
        }