日期:2014-05-17  浏览次数:20392 次

加大括号这是什么写法?
本帖最后由 will_stier 于 2013-01-04 16:46:40 编辑

  public class AdminController : Controller
    {
        //
        // GET: /Admin/
        IUserService iuser = new UserService();
        public ActionResult Index()
        {
            return View();
        }


        public ActionResult Login() 
        {
            Session["user"] = new User() {  usr_cd="admin",  usr_password="123456" };//看一个MVC3的例子,不知道这里为什么可以这样写。似乎不是传统的构造方法
            return View();
        
        }

        public ActionResult GetUserLogin(string uid, string pwd, string chk) 
        {
           

            string str = Session["chk"].ToString();
            if (str != chk)
            {   //验证码错误
                return Content("-1");
            }
            else
            {
                //开始进入判断
             
                User uInfo = iuser.VolidateUserLogin(new User() {  usr_cd = uid, usr_password = pwd, usr_lgn_time = DateTime.Now.ToString(), usr_lgn_ip = Request.UserHostAddress });
                if (uInfo!=null)
                {
                    //登陆成功跳转主页
                    Session["user"] = uInfo;//"CrmMain/Index"
                    return Content("1");
                }
                else
         &