示例#1
0
        // POST: IPTSELogin/Create
        // To protect from overposting attacks, please enable the specific properties you want to bind to, for
        // more details see https://go.microsoft.com/fwlink/?LinkId=317598.
        //[HttpPost]
        //[ValidateAntiForgeryToken]
        public ActionResult Createpassword(login_table login_table)
        {
            if (ModelState.IsValid)
            {
                //login_table.Id = Int32.Parse(Session["createpass"].ToString());
                try
                {
                    login_table.Id    = login_table.Id;
                    login_table.email = login_table.email;
                    byte[] encode = new byte[login_table.password.Length];
                    encode = System.Text.Encoding.UTF8.GetBytes(login_table.password);
                    login_table.password   = Convert.ToBase64String(encode);
                    login_table.Login_type = "Individual";
                    db1.login_table.Add(login_table);
                    db1.SaveChanges();
                    //TempData["Message"] = "Password Created Successfully. Login To Continue..";
                    return(RedirectToAction("Login", "IPTSELogin"));
                }
                catch (Exception ex)
                {
                    ViewBag.ErrorMessage = "Already Created! Please go through Forgot Password!";
                    return(View());
                }
            }

            return(View());
        }
示例#2
0
        public string Createpassword(login_table login_table)
        {
            string returMsg = string.Empty;

            if (ModelState.IsValid)
            {
                //login_table.Id = Int32.Parse(Session["createpass"].ToString());
                try
                {
                    login_table.Id    = login_table.Id;
                    login_table.email = login_table.email;
                    byte[] encode = new byte[login_table.password.Length];
                    encode = System.Text.Encoding.UTF8.GetBytes(login_table.password);
                    login_table.password   = Convert.ToBase64String(encode);
                    login_table.Login_type = "Individual";
                    db1.login_table.Add(login_table);
                    db1.SaveChanges();
                    returMsg = "Success";
                }
                catch (Exception ex)
                {
                    ViewBag.ErrorMessage = "Contact Support team. Registration process failed for userid - " + login_table.Id;
                    returMsg             = ViewBag.ErrorMessage;
                    return(returMsg);
                }
            }
            else
            {
                returMsg = "Contact Support team. Login Creation process failed for userid - " + login_table.Id;
            };

            return(returMsg);
        }