Esempio n. 1
0
 public TrainingExerciseSetKey(TrainingExerciseSetKey key)
 {
     UserId             = key.UserId;
     Year               = key.Year;
     WeekOfYear         = key.WeekOfYear;
     DayOfWeek          = key.DayOfWeek;
     TrainingDayId      = key.TrainingDayId;
     TrainingExerciseId = key.TrainingExerciseId;
     Id = key.Id;
 }
Esempio n. 2
0
        public TrainingExerciseSetKey Clone()
        {
            var copy = new TrainingExerciseSetKey();

            copy.UserId             = UserId;
            copy.Year               = Year;
            copy.WeekOfYear         = WeekOfYear;
            copy.DayOfWeek          = DayOfWeek;
            copy.TrainingDayId      = TrainingDayId;
            copy.TrainingExerciseId = TrainingExerciseId;
            copy.Id = Id;
            return(copy);
        }
        /// <summary>
        /// Delete data in database
        /// </summary>
        /// <param name="key">Primary Key</param>
        public void Delete(TrainingExerciseSetKey key)
        {
            if (key == null || string.IsNullOrWhiteSpace(key.UserId) || key.Year == 0 || key.WeekOfYear == 0 ||
                key.DayOfWeek < 0 || key.DayOfWeek > 6 || key.TrainingExerciseId == 0 || key.Id == 0)
                return;

            var row = _dbContext.TrainingExerciseSet.Where(t => t.UserId == key.UserId && t.Year == key.Year &&
                                                                 t.WeekOfYear == key.WeekOfYear && t.DayOfWeek == key.DayOfWeek &&
                                                                 t.TrainingDayId == key.TrainingDayId && t.TrainingExerciseId == key.TrainingExerciseId &&
                                                                 t.Id == key.Id).FirstOrDefault();
            if (row != null)
            {
                _dbContext.TrainingExerciseSet.Remove(row);
                _dbContext.SaveChanges();
            }
        }
Esempio n. 4
0
 public TrainingExerciseSetKey Clone()
 {
     var copy = new TrainingExerciseSetKey();
     copy.UserId = UserId;
     copy.Year = Year;
     copy.WeekOfYear = WeekOfYear;
     copy.DayOfWeek = DayOfWeek;
     copy.TrainingDayId = TrainingDayId;
     copy.TrainingExerciseId = TrainingExerciseId;
     copy.Id = Id;
     return copy;
 }
Esempio n. 5
0
 public TrainingExerciseSetKey(TrainingExerciseSetKey key)
 {
     UserId = key.UserId;
     Year = key.Year;
     WeekOfYear = key.WeekOfYear;
     DayOfWeek = key.DayOfWeek;
     TrainingDayId = key.TrainingDayId;
     TrainingExerciseId = key.TrainingExerciseId;
     Id = key.Id;
 }
Esempio n. 6
0
 public TrainingExerciseSet(TrainingExerciseSetKey key)
     : base(key)
 {
 }
        /// <summary>
        /// Get data in database
        /// </summary>
        /// <param name="key">Primary Key</param>
        /// <returns>read data</returns>
        public TrainingExerciseSet Get(TrainingExerciseSetKey key)
        {
            if (key == null || string.IsNullOrWhiteSpace(key.UserId) ||
                key.Year == 0 || key.WeekOfYear == 0 || key.DayOfWeek < 0 || key.DayOfWeek > 6 || key.TrainingExerciseId == 0 || key.Id == 0)
                return null;

            var row = _dbContext.TrainingExerciseSet.Where(t => t.UserId == key.UserId && t.Year == key.Year &&
                                                              t.WeekOfYear == key.WeekOfYear && t.DayOfWeek == key.DayOfWeek &&
                                                              t.TrainingDayId == key.TrainingDayId &&
                                                              t.TrainingExerciseId == key.TrainingExerciseId && t.Id == key.Id).FirstOrDefault();
            if (row != null)
            {
                return TrainingExerciseSetTransformer.ToBean(row);
            }
            return null;
        }
Esempio n. 8
0
 public TrainingExerciseSet(TrainingExerciseSetKey key) : base(key)
 {
 }