コード例 #1
0
        public IHttpActionResult GetChallenges()
        {
            var challenges = RepositoryProvider.Get <ChallengeRepository>().GetAvailableChallenges(CurrentAccess.UserId);
            var result     = challenges.Select(p => ChallengeViewModel.Create(p, CurrentAccess.UserId)).ToList();

            return(Ok(result));
        }
コード例 #2
0
        public async Task <IHttpActionResult> GetChallenge(Guid challengeId)
        {
            var challenge =
                await
                RepositoryProvider.Get <ChallengeRepository>().Get(p => p.ChallengeId == challengeId)
                .Include("Deeds")
                .FirstOrDefaultAsync();

            if (challenge == null)
            {
                return(NotFound());
            }

            var result = ChallengeViewModel.Create(challenge, CurrentAccess.UserId);

            return(Ok(result));
        }