public ActionResult doLogin(string email, string password) { password = Crypto.SHA256(password); //System.Diagnostics.Debug.Write(email + password); List <string> flagLogin = auh.login(email, password); Dictionary <string, string> userData = new Dictionary <string, string>(); if (flagLogin.Count > 0) { userData.Add("email", email); userData.Add("idaccount", flagLogin[0]); userData.Add("roleaccount", flagLogin[1]); Session["uu"] = userData; Session["idprofile"] = ph.GetProfileFromAccount(flagLogin[0]); Session["namaprofile"] = ph.GetNamaProfileFromProfile(Session["idprofile"].ToString()); System.Diagnostics.Debug.WriteLine("Login Session IDProfile = " + Session["idprofile"]); System.Diagnostics.Debug.WriteLine("Login Session NamaProfile = " + Session["namaprofile"]); return(Redirect(url + "searchProfile/index")); } else { Session["mess"] = "Sukses Register"; return(Redirect(url + "searchProfile/index")); } //return View("register"); }
public ActionResult doCreateProfile(string nama, string instansi) { if (Session["uu"] != null) { System.Diagnostics.Debug.Write(nama + instansi); Dictionary <string, string> userData = (Dictionary <string, string>)Session["uu"]; var id = userData["idaccount"]; var ResultInsert = ph.createProfile(nama, instansi, Convert.ToInt32(id)); Session["idprofile"] = ResultInsert; Session["namaprofile"] = ph.GetNamaProfileFromProfile(ResultInsert.ToString()); System.Diagnostics.Debug.WriteLine("Session IDProfile = " + Session["idprofile"]); System.Diagnostics.Debug.WriteLine("Session NamaProfile = " + Session["namaprofile"]); var ResultUpdate = auh.updateAccountSetProfileMain(ResultInsert, int.Parse(id)); return(RedirectToAction("index", "searchProfile")); } else { return(Redirect(url + "Auth/login")); } }