示例#1
0
        public ActionResult <IEnumerable <ExerciseReadDto> > GetAllExercises()
        {
            if (!Request.Headers.ContainsKey("token"))
            {
                return(Unauthorized());
            }

            var auth         = Request.Headers["token"];
            var accountModel = _validate.GetAccountByToken(auth);

            if (accountModel == null)
            {
                return(Unauthorized());
            }

            var ExerciseItems = _repository.GetAllExercises(accountModel.Id);

            return(Ok(_mapper.Map <IEnumerable <ExerciseReadDto> >(ExerciseItems)));
        }
示例#2
0
        public ActionResult <IEnumerable <ExerciseModel> > GetAllExercises()
        {
            var exercises = _repo.GetAllExercises();

            return(Ok(exercises));
        }