Beispiel #1
0
        public ActionResult Register(string uAutograph, string uName, string uPwd)
        {
            var d1 = db.sayHi_UserInfo.Where(a => a.Name == uName);

            if (d1.ToList().Count() > 0)
            {
                return(Content("账号已经存在", "text/plain"));
            }
            sayHi_UserInfo readlyAdd = new sayHi_UserInfo()
            {
                Name         = uName.Trim(),
                Pwd          = uPwd,
                Autograph    = uAutograph,
                BannerPic    = "~/img/banner/banner_1.jpg",
                CreateTime   = DateTime.Now,
                Effect       = true,
                HeadPortrait = "~img/other/b.jpg",
                Integral     = 1,
                Power        = 1
            };

            db.sayHi_UserInfo.Add(readlyAdd);
            if (db.SaveChanges() > 0)
            {
                Session["UserInfo"] = readlyAdd;
                return(Content("注册成功", "text/plain"));
            }
            else
            {
                return(Content("注册失败", "text/plain"));
            }
        }
Beispiel #2
0
 // GET: Person
 public ActionResult Index()
 {
     _uModel = Session["UserInfo"] as sayHi_UserInfo;
     return(View(_uModel));
 }