Exemplo n.º 1
0
        public UserLiftSet MapDALToUserLiftSet(DAL.App.DTO.ExerciseSet dalEntity)
        {
            if (dalEntity.NrOfReps == null)
            {
                throw new ApplicationException("Number of reps cannot be null on a lift set");
            }
            if (dalEntity.Weight == null)
            {
                throw new ApplicationException("Weight cannot be null on a lift set");
            }

            var baseLiftSet = new UserLiftSet
            {
                Id = dalEntity.Id,

                SetNumber = dalEntity.SetNumber,
                ExerciseInTrainingDayId = dalEntity.ExerciseInTrainingDayId,
                SetTypeId = dalEntity.SetTypeId,
                SetType   = dalEntity.SetType == null
                    ? null
                    : BLLMapperContext.SetTypeMapper.MapDALToBLL(dalEntity.SetType),
                NrOfReps = (int)dalEntity.NrOfReps,
                Weight   = (float)dalEntity.Weight
            };

            return(baseLiftSet);
        }
Exemplo n.º 2
0
 public ExerciseSet MapDALToBLL(DAL.App.DTO.ExerciseSet dalObject)
 {
     return(new ExerciseSet
     {
         Id = dalObject.Id,
         ExerciseInTrainingDayId = dalObject.ExerciseInTrainingDayId,
         WorkoutRoutineId = dalObject.WorkoutRoutineId,
         Completed = dalObject.Completed,
         Weight = dalObject.Weight,
         Distance = dalObject.Distance,
         Duration = dalObject.Duration,
         NrOfReps = dalObject.NrOfReps,
         SetNumber = dalObject.SetNumber,
         SetTypeId = dalObject.SetTypeId,
         SetType = dalObject.SetType == null
             ? null
             : BLLMapperContext.SetTypeMapper.MapDALToBLL(dalObject.SetType)
     });
 }