コード例 #1
0
        public ActionResult ForgotPassword(int accid, FormCollection form)
        {
            LecturerModel       lecturer = new LecturerModel();
            List <AccountModel> accounts = lecturer.GetAccount(null, new List <string> {
                "id = " + accid + ""
            });
            HttpCookie gdsjhgfjhsdgjhf = new HttpCookie("gdsjhgfjhsdgjhf", accid.ToString());

            Response.Cookies.Add(gdsjhgfjhsdgjhf);

            if (form["password"].ToString() != null)
            {
                lecturer.Password = form["password"].ToString();
                lecturer.ChangeAccount(new List <string> {
                    "id = " + accid + ""
                });
            }

            return(View());
        }
コード例 #2
0
        public ActionResult Edit(FormCollection form)
        {
            Validation.Validation validation = new Validation.Validation();

            if (validation.CheckString(form["Username"].ToString()) &&
                validation.CheckString(form["Password"].ToString()) &&
                validation.CheckString(form["FirstName"].ToString()) &&
                validation.CheckString(form["LastName"].ToString()) &&
                validation.CheckNum(form["ProfessionalLevel"].ToString()) &&
                validation.CheckPhoneNumber(form["Phone"].ToString()) &&
                validation.IsValidEmail(form["Email"].ToString()) && validation.checknull(form["Email"].ToString()))
            {
                lecturer.Username = form["Username"].ToString();
                lecturer.Password = form["Password"].ToString();
                lecturer.Name     = form["FirstName"].ToString();
                lecturer.Surname  = form["LastName"].ToString();
                lecturer.Level    = int.Parse(form["ProfessionalLevel"].ToString());
                lecturer.Cell     = form["Phone"].ToString();
                lecturer.Email    = form["Email"].ToString();

                lecturer.ChangeAccount(new List <string> {
                    " id = " + lecturer.AccId
                });
                lecturer.ChangeLecturer(new List <string> {
                    "id = " + lecturer.LectID
                });
            }



            if (Session["USER"] != null)
            {
                return(View(lecturer));
            }

            return(RedirectToAction("Index", "Home"));
        }