/// <summary>
        /// CreateChallengesAsync
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public async Task <List <ContestResponse> > CreateChallengesAsyc(ChallengeRequest request)
        {
            if (request == null || request.BaseInputs == null || request.LearningPaths == null)
            {
                throw new ArgumentNullException("Challenge request does not contain required fields");
            }

            List <ContestResponse> contestReponseList = await CreateCollectionChallengesAsync(
                request.LearningPaths,
                request.BaseInputs);

            return(contestReponseList);
        }
Exemple #2
0
        public static ChallengeRequest CreateChallengeRequest(string jsonChallengeRequest)
        {
            ChallengeRequest request = JsonConvert.DeserializeObject <ChallengeRequest>(jsonChallengeRequest);

            if (request == null)
            {
                throw new ArgumentException("Error parsing challenge request JSON");
            }

            if (string.IsNullOrWhiteSpace(request.BaseInputs.Mstpid))
            {
                throw new ArgumentNullException($"{nameof(request.BaseInputs.Mstpid)} must be valid");
            }

            // Extend End Date
            DateTime startDate = DateTime.Parse(request.BaseInputs.StartDateStr);

            request.BaseInputs.EndDateStr = startDate.AddMonths(6).ToString("MM-dd-yyyy HH:mm:ss");

            return(request);
        }