예제 #1
0
        public ActionResult Register(string Email, string UserName, string Pwd)
        {
            if (GetValue.WithoutRegisterName(UserName))
            {
                return(Content("ero"));
            }

            var users = new User();

            users.Email    = Email;
            users.UserName = UserName;
            users.PassWord = GetValue.GetStrMd5(Pwd);
            users.GroupId  = 2;
            //users.Power = 0;
            context.Users.Add(users);
            context.SaveChanges();
            return(Content("suc"));
        }
예제 #2
0
        public ActionResult Login(string Name, string Pwd)
        {
            string p        = GetValue.GetStrMd5(Pwd);
            var    UserList = (from u in context.Users
                               where u.UserName == Name && u.PassWord == p
                               select u).SingleOrDefault();

            if (UserList == null)
            {
                return(Content("ero"));
            }

            //Session["Power"] = UserList.Power;
            Session["Name"]    = UserList.UserName;
            Session["Email"]   = UserList.Email;
            Session["UserId"]  = UserList.UserId;
            Session["GroupId"] = UserList.GroupId;
            return(Content("suc"));
        }