Exemplo n.º 1
0
        public virtual async Task <HttpResponseMessage> Register(ProProfsRegistrationModel model)
        {
            model.token    = this.profopsOptions.Value.ApplicationKey;
            model.username = this.profopsOptions.Value.UserName;
            string json        = JsonConvert.SerializeObject(model);
            var    httpContent = new StringContent(json, Encoding.UTF8, "application/json");

            return(await this._httpclienthandler.PostAsync(this.profopsOptions.Value.ProProfsRegisterUrl, httpContent));
        }
Exemplo n.º 2
0
        public virtual async Task <bool> AddUserToQuiz(ProProfsUser userModel)
        {
            var reegistermodel = new ProProfsRegistrationModel();

            reegistermodel.email           = userModel.Email;
            reegistermodel.quiz_assignment = userModel.Quizzes.Select(x => x.EncodedQuizLink).ToArray();
            var result = await this.profProfsProxy.Register(reegistermodel);

            if (result.StatusCode != System.Net.HttpStatusCode.OK)
            {
                return(false);
            }

            var response     = result.Content.ReadAsStringAsync();
            var jsonResponse = JObject.Parse(response.Result);
            var status       = jsonResponse["status"];

            if (status.Value <string>() == ProProfsStatus.ERROR.ToString())
            {
                return(false);
            }

            return(true);
        }