Ejemplo n.º 1
0
        public ActionResult SaveUser(User user, string BtnSubmit)
        {
            UserBusinessLayer userBusinessLayer = new UserBusinessLayer();

            if (BtnSubmit == "提交更改")
            {
                userBusinessLayer.UpdataUsers(user.U_name, user);
            }
            else if (BtnSubmit == "添加")
            {
                userBusinessLayer.InsertUser(user);
            }

            return(RedirectToAction("Information"));

            //CreateUserViewModel v = new CreateUserViewModel();
            //v.user = userBusinessLayer.GetUser(Session["User"].ToString());
            //return PartialView("CreateUser", v);
        }
Ejemplo n.º 2
0
        public ActionResult UpdataUser(User user, string BtnSubmit)
        {
            //给Session["UserTable"]取反,使重定向后依然能够显示usertable
            //Session["UserTable"] = !Convert.ToBoolean(Session["UserTable"]);
            //Session["LoginRecord"] = !Convert.ToBoolean(Session["LoginRecord"]);
            UserBusinessLayer userBusinessLayer = new UserBusinessLayer();

            if (BtnSubmit == "提交更改")
            {
                //userBusinessLayer.InsertUser(user);
                userBusinessLayer.UpdataUsers(Session["User"].ToString(), user);
                return(RedirectToAction("Information"));
            }
            else if (BtnSubmit == "取消")
            {
                return(RedirectToAction("Information"));
            }

            //UpdataUser不需要控制器来决定,这段代码没用
            CreateUserViewModel createUserViewModel = new CreateUserViewModel();

            createUserViewModel.user = userBusinessLayer.GetUser(Session["User"].ToString());
            return(PartialView("UpdataUser", createUserViewModel));
        }