コード例 #1
0
 public Session CreateSession(User user)
 {
     Session session = new Session()
     {
         id_user = user.id,
         session_key = Guid.NewGuid().ToString(),
         expire = DateTime.Now
     };
     db.Sessions.InsertOnSubmit(session);
     db.SubmitChanges();
     return GetSession(session.session_key);
 }
コード例 #2
0
 partial void DeleteUser(User instance);
コード例 #3
0
 partial void UpdateUser(User instance);
コード例 #4
0
 partial void InsertUser(User instance);
コード例 #5
0
        public WebResult Register(string username, string email, string password)
        {
            WebResult result = new WebResult();

            var users = from u in db.Users where u.username == username || u.email == email select u;
            if (username == "" || password == "" || email == "")
                result.ErrorCode = WebResult.ErrorCodeList.INFORMATION_REQUIRED;
            else if (users.Count() > 0)
                result.ErrorCode = WebResult.ErrorCodeList.USER_ALREADY_EXIST;
            if (result.ErrorCode != WebResult.ErrorCodeList.SUCCESS)
                return result;
            User user = new User()
            {
                username = username,
                email = email,
                password = password
            };
            db.Users.InsertOnSubmit(user);
            db.SubmitChanges();
            return result;
        }
コード例 #6
0
 public AccountData(User user)
 {
     Id = user.id;
     Username = user.username;
     Password = user.password;
     IsSuperUser = user.superuser;
 }