Esempio n. 1
0
 public ActionResult Register(StudentInfo userModel)
 {
     userModel.Authority = "0";
     ModelHelpers mHelp = new ModelHelpers();
     mHelp.Add<StudentInfo>(userModel);
     CourseCenter.Common.TakeCookie.SetCookie("userId", userModel.Id.ToString());
     return RedirectToAction("StudentIndex", "Home");
 }
        public ActionResult StudentCenter(StudentInfo studentInfo)
        {
            try
            {

                studentInfo.Id = new Guid(studentId);
                studentInfo.Pwd = studentInfo.Pwd.Trim();
                if (string.IsNullOrEmpty(studentInfo.Pwd) || studentInfo.Pwd == "不修改就不需要输入")
                {
                    mHelp.Modify<StudentInfo>(studentInfo, new string[] { "Id", "Account", "UserName", "Sex" });
                    TempData["res"] = "修改成功";
                    return RedirectToAction("StudentCenter");
                }
                mHelp.Modify<StudentInfo>(studentInfo, new string[] { "Id", "Account", "UserName", "Pwd", "Sex" });
                TempData["res"] = "修改成功";
            }
            catch (Exception)
            {
                TempData["res"] = "<font color='red'>修改失败,请点解cancel或刷新 后 重新输入!<font/>";
            }

            return RedirectToAction("StudentCenter");
        }
 /// <summary>
 /// 注册页面
 /// </summary>
 /// <returns></returns>
 public ActionResult Rgist(StudentInfo studentInfo)
 {
     mHelp.Add<StudentInfo>(studentInfo);
     return View();
 }