コード例 #1
0
        public async Task <IActionResult> Adhesion(Adhesion adhesion)
        {
            JsonObjectAttribute receivedResponse;

            //    GetUserName();
            //   adhesion.userName = HttpContext.Session.GetString("userName").ToString();
            using (var httpClient = new HttpClient())
            {
                StringContent content = new StringContent(JsonConvert.SerializeObject(adhesion), Encoding.UTF8, "application/json");
                using (var response = await httpClient.PostAsync(BaseUrl + "adhesions/" + HttpContext.Session.GetString("courriel") + "/" + HttpContext.Session.GetString("password"), content))
                {
                    string apiResponse = await response.Content.ReadAsStringAsync();

                    try
                    {
                        receivedResponse = JsonConvert.DeserializeObject <JsonObjectAttribute>(apiResponse);
                    }
                    catch (Exception ex)
                    {
                        ViewBag.Result = apiResponse;
                        return(View());
                    }
                }
            }
            return(View());
        }
コード例 #2
0
 public static Adhesion CreateAdhesion(string pPath, string pAPIKey, Adhesion pAdhesion, bool pAutoSign)
 {
     try {
         string autoSign = "";
         return(ApiRestServices.CreateObject <Adhesion>(pPath + "/adhesion" + autoSign, pAPIKey, "adhesion", pAdhesion));
     }
     catch (ApplicationException ae)
     {
         throw new ApplicationException(ae.Message);
     }
 }
コード例 #3
0
        public async Task <IActionResult> TraiterDemande(Adhesion adhesion)
        {
            string reponse = "";

            using (var httpClient = new HttpClient())
            {
                var           data    = new  { userName = adhesion.userName, nomGroupe = adhesion.nomGroupe, status = adhesion.status };
                StringContent content = new StringContent(JsonConvert.SerializeObject(data), Encoding.UTF8, "application/json");
                using (var response = await httpClient.PutAsync(BaseUrl + "adhesions/" + HttpContext.Session.GetString("courriel") + "/" + HttpContext.Session.GetString("password"), content))
                {
                    string apiResponse = await response.Content.ReadAsStringAsync();

                    reponse        = apiResponse;
                    ViewBag.Result = "Success";
                }
            }
            if (reponse.Equals("1"))
            {
                return(RedirectToAction("Index", "Home"));
            }
            return(View());
        }
コード例 #4
0
        public static Adhesion CreateAdhesion(string pPath, string pAPIKey, Adhesion pAdhesion, bool pAutoSign)
        {
            string autoSign = "";

            return(ApiRestServices.CreateObject <Adhesion>(pPath + "/adhesion" + autoSign, pAPIKey, "adhesion", pAdhesion));
        }
コード例 #5
0
        public ActionResult TraiterDemande()
        {
            Adhesion adhesion = new Adhesion();

            return(View(adhesion));
        }
コード例 #6
0
        public ActionResult Invitation()
        {
            Adhesion adhesion = new Adhesion();

            return(View(adhesion));
        }