public ActionResult <IEnumerable<FavoriteReadDto>> GetAllUserFavorites()
        {
            if (!Request.Headers.ContainsKey("token"))
            {
                return Unauthorized();
            }

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

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

            var FavoriteItems = _repository.GetAllUserFavorites(accountModel.Id);

            return Ok(_mapper.Map<IEnumerable<FavoriteReadDto>>(FavoriteItems));
        }
Exemple #2
0
        public ActionResult <IEnumerable <ExerciseReadDto> > GetAllPetExercises(Guid Id)
        {
            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.GetAllPetExercises(Id, accountModel.Id);

            return(Ok(_mapper.Map <IEnumerable <ExerciseReadDto> >(ExerciseItems)));
        }