コード例 #1
0
        public async Task <User> CreateAsync(User user)
        {
            var dateTime = DateTime.UtcNow;

            user.last_login   = dateTime;
            user.created_at   = dateTime;
            user.access_token = _tokenService.GenerateToken(user.email);
            user.password     = _hashService.EncryptPassword(user.password);

            await _repo.InsertOneAsync(user);

            return(user);
        }