// GET: User public ActionResult Login(string username, string password) { HttpClient client = new HttpClient(); client.BaseAddress = new Uri("http://localhost:18080"); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); HttpResponseMessage response = client.GetAsync("PI_OTDAV_4GL5B-web/api/user/" + username + "/" + password).Result; if (response.IsSuccessStatusCode) { ViewBag.result = response.Content.ReadAsAsync <User>().Result; if (ViewBag.result != null) { if (ViewBag.result.accountType == "ADMINISTRATEUR") { return(View("Admin")); } else if ((ViewBag.result.accountType == "DEPOSITOR" || ViewBag.result.accountType == "MEMBER") && ViewBag.result.accountStatuts == "ACTIF") { Session["id"] = ViewBag.result.id; Session["nom"] = ViewBag.result.firstName; Session["prenom"] = ViewBag.result.lastName; Session["user"] = ViewBag.result.userName; Session["userName"] = ViewBag.result.userName; Session["nbNotif"] = ns.GetNbNotif(ViewBag.result.id); return(View("Dashbord")); } else if ((ViewBag.result.accountType == "DEPOSITOR" || ViewBag.result.accountType == "MEMBER") && ViewBag.result.accountStatuts == "BANNED") { return(View("Banned")); } else if (ViewBag.result.accountType == "MEMBER" && ViewBag.result.accountStatuts == "WAIT") { return(View("Wait")); } } else if (ViewBag.result == null) { ViewBag.NotValidUser = "******"; } else { ViewBag.Failedcount -= 1; } } else { ViewBag.result = "Error"; } return(View("login")); }