Esempio n. 1
0
        public void UpdateHabit(Guid habitId, Guid userID, string newName, string[] days)
        {
            var habit   = GetSpecificHabitByIdAndUserId(habitId, userID);
            var daysoff = GetHabitDaysOff(habitId);

            DaysOffValue dv = HabitFactory.value(days);

            habit.Name      = newName;
            daysoff.daysoff = dv.value;
        }
Esempio n. 2
0
        public void addNewHabit(string name, Guid userID, string[] days)
        {
            if (name == null)
            {
                throw new ArgumentException("name cannot be empty");
            }

            Habit h = HabitFactory.addNewHabit(userID, name);

            _context.Habits.Add(h);

            DaysOffValue dv = HabitFactory.value(days);

            if (!days.Equals(null))
            {
                DaysOff d = HabitFactory.AssignDaysOff(h.ID, dv.value);
                _context.daysOffs.Add(d);
            }
        }