Exemplo n.º 1
0
 public GetChallengeResponse GetChallenge(GetChallengeRequest request)
 {
     return(DataContext.Challenges.Where(x => x.Id == request.Id)
            .Include(x => x.Relations)
            .Include(x => x.Relations.Select(y => y.ThreatHost))
            .Include(x => x.Relations.Select(y => y.OpportunityHost))
            .Include(x => x.Relations.Select(y => y.WeaknessHost))
            .Include(x => x.Relations.Select(y => y.StrengthHost))
            .FirstOrDefault().MapTo <GetChallengeResponse>());
 }
 /// <summary>
 /// Begin a new GetChallengeRequest
 /// </summary>
 /// <param name="requestData"></param>
 /// <returns></returns>
 public GetChallengeResponse GetChallengeRequest(GetChallengeRequest requestData)
 {
     return(JsonConvert.DeserializeObject <GetChallengeResponse>(Requestor.PostString(Urls.GetChallengeRequest, JsonHelper.SerializeData(requestData)).ResponseJson));
 }
        /// <summary>
        /// Begin a new asynchronous GetChallengeRequest
        /// </summary>
        /// <param name="requestData"></param>
        /// <returns></returns>
        public async Task <GetChallengeResponse> GetChallengeRequestAsync(GetChallengeRequest requestData)
        {
            var res = await Requestor.PostStringAsync(Urls.GetChallengeRequest, JsonHelper.SerializeData(requestData));

            return(JsonConvert.DeserializeObject <GetChallengeResponse>(res.ResponseJson));
        }