コード例 #1
0
        public async Task <HttpResponseMessage> CreateChallenges([FromBody] ChallengesPackage challengpkg)
        {
            if (!ModelState.IsValid)
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest));
            }

            var result = await challengeManager.CreateChallenge(challengpkg);

            if (!result)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "something went wrong"));
            }
            return(Request.CreateResponse(HttpStatusCode.Created, "Request successfully sent"));
        }
コード例 #2
0
 public static void Main()
 {
     var c1 = ChallengeManager.CreateChallenge();
     var c2 = ChallengeManager.CreateChallenge();
     //var c = ChallengeManager.CreateChallenge<Challenage>(); // This statement won't compile
 }