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)); }
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)); }