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()); }
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); } }
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()); }
public static Adhesion CreateAdhesion(string pPath, string pAPIKey, Adhesion pAdhesion, bool pAutoSign) { string autoSign = ""; return(ApiRestServices.CreateObject <Adhesion>(pPath + "/adhesion" + autoSign, pAPIKey, "adhesion", pAdhesion)); }
public ActionResult TraiterDemande() { Adhesion adhesion = new Adhesion(); return(View(adhesion)); }
public ActionResult Invitation() { Adhesion adhesion = new Adhesion(); return(View(adhesion)); }