Example #1
0
        public async Task <ActionResponseDTO> GetList()
        {
            ActionResponseWrapper actionResponseWrapper = new ActionResponseWrapper(typeof(ChallengeApp).FullName);

            //Gets the challenges in the database
            IList <Challenge> foundChallenges = await challengeInfrastructure.GetList();

            //Translates
            IList <ChallengeDTO> challengesDTO = ChallengeTranslator.SetDTO(foundChallenges);

            //Prepares the return
            actionResponseWrapper.SetContent(challengesDTO);

            return(actionResponseWrapper.Value);
        }
Example #2
0
        public async Task <ActionResponseDTO> GetById(int id)
        {
            ActionResponseWrapper actionResponseWrapper = new ActionResponseWrapper(typeof(ChallengeApp).FullName);

            //Gets the challenge in the database
            Challenge foundChallenge = await challengeInfrastructure.GetById(id);

            //Translates
            ChallengeDTO challengeDTO = ChallengeTranslator.SetDTO(foundChallenge);

            //Prepares the return
            actionResponseWrapper.SetContent(challengeDTO);

            return(actionResponseWrapper.Value);
        }