예제 #1
0
        public void CreateBlog(User user, string title, string content)
        {
            var date = ((long)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds) * 1000;

            _cassandraConnection.ExecuteNonReader(_createBlog.Bind(new
            {
                writer  = user.UserName,
                title   = title,
                content = content,
                date    = date
            }));
        }
예제 #2
0
        public User Register(string username, string password)
        {
            using (var deriveBytes = new Rfc2898DeriveBytes(password, 30))
            {
                var salt = deriveBytes.Salt;
                var key  = deriveBytes.GetBytes(30);

                _cassandraConnection.ExecuteNonReader(_createUser.Bind(new
                {
                    username = username,
                    password = Utils.ToHexString(key),
                    salt     = Utils.ToHexString(salt)
                }));
            }
            return(new User
            {
                UserName = username
            });
        }