Пример #1
0
        public static Exercise CreateExercise(ISession session, Profile profile, string name, string shortCut, ExerciseType exerciseType = ExerciseType.Klatka, MechanicsType mechanicsType = MechanicsType.Compound, ExerciseForceType forceType = ExerciseForceType.Push, ExerciseDifficult difficult = ExerciseDifficult.One, Guid?globalId = null)
        {
            if (globalId == null)
            {
                globalId = Guid.NewGuid();
            }
            Exercise exercise = new Exercise(globalId.Value);

            exercise.Profile           = profile;
            exercise.Name              = name;
            exercise.Shortcut          = shortCut;
            exercise.ExerciseType      = exerciseType;
            exercise.ExerciseForceType = forceType;
            exercise.MechanicsType     = mechanicsType;
            exercise.Difficult         = ExerciseDifficult.NotSet;
            session.Save(exercise);
            session.Flush();
            return(exercise);
        }
Пример #2
0
        public static Exercise CreateExercise(ISession session, Profile profile, string name, string shortCut, PublishStatus status, ExerciseType exerciseType = ExerciseType.Klatka, MechanicsType mechanicsType = MechanicsType.Compound, ExerciseForceType forceType = ExerciseForceType.Push, ExerciseDifficult difficult = ExerciseDifficult.One)
        {
            Exercise exercise = new Exercise(Guid.NewGuid());

            exercise.Profile      = profile;
            exercise.Name         = name;
            exercise.Shortcut     = shortCut;
            exercise.ExerciseType = exerciseType;
            exercise.Status       = status;
            if (status == PublishStatus.Published)
            {
                exercise.PublishDate = DateTime.UtcNow;
            }
            exercise.ExerciseForceType = forceType;
            exercise.MechanicsType     = mechanicsType;
            exercise.Difficult         = ExerciseDifficult.NotSet;
            session.Save(exercise);
            session.Flush();
            return(exercise);
        }