Ejemplo 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);
        }
Ejemplo n.º 2
0
 public DAL.App.DTO.ExerciseSet MapUserLiftSetToDALEntity(UserLiftSet userLiftSet)
 {
     return(new DAL.App.DTO.ExerciseSet
     {
         Id = userLiftSet.Id,
         NrOfReps = userLiftSet.NrOfReps,
         SetNumber = userLiftSet.SetNumber,
         ExerciseInTrainingDayId = userLiftSet.ExerciseInTrainingDayId,
         SetTypeId = userLiftSet.SetTypeId,
         Weight = userLiftSet.Weight
     });
 }