Beispiel #1
0
        public IActionResult Add([FromBody] ClientExercise clientExercise)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var user_ID = _jwtHandler.GetUserID(_httpContextAccessor.HttpContext);

            //_roleService.IsUserManager(user_ID);

            byte[]   Recording = Helper.Compress(clientExercise.Recording);
            Exercise exercise  = (Exercise)_exerciseService.AddWithReturn(new Exercise {
                Name = clientExercise.Name, Description = clientExercise.Description, Recording = Recording
            });

            _userExerciseService.Add(user_ID, exercise.ID);


            return(Ok(exercise));
        }