Пример #1
0
 public static DayOff GetInstance()
 {
     if (_dayOff == null)
     {
         _dayOff = new DayOff();
     }
     return(_dayOff);
 }
Пример #2
0
 public Habit(Guid Id, String name, String[] daysOff, Int16 currentStreak, Int16 longestStreak, Int16 logCount, DateTime[] logs, Guid userId, DateTime createdAt)
 {
     this.ID        = Id;
     this.Name      = new Name(name);
     this.DaysOff   = DayOff.GetInstance().SetDayOff(daysOff);
     this.Log       = new Log(currentStreak, longestStreak, logCount, logs);
     this.UserID    = userId;
     this.CreatedAt = createdAt;
 }
Пример #3
0
        public static Habit Create(RequestData data, Guid userId)
        {
            UserRepository user = new UserRepository();
            var            u    = user.Find(userId);

            if (u == null)
            {
                return(null);
            }

            Habit newData = new Habit
            {
                DaysOff   = DayOff.GetInstance().SetDayOff(data.DaysOff),
                Name      = new Name(data.Name),
                UserID    = userId,
                ID        = Guid.NewGuid(),
                CreatedAt = DateTime.Now
            };

            return(newData);
        }