Ejemplo n.º 1
0
        public async Task LogoutAsync(UserSessionId id, DateTime utcNow)
        {
            var sqlParams = new
            {
                Id         = id.RawValue,
                LogoutTime = DateTime.UtcNow
            };

            string sql = @";
                UPDATE dbo.UserSessions
                SET LogoutTime = @LogoutTime
                WHERE Id = @Id
                    AND LogoutTime IS NULL;
            ";

            await _db.Execute(async (db) =>
            {
                await db.ExecuteAsync(sql, sqlParams);
            });
        }
Ejemplo n.º 2
0
        public async Task UpdateAsync(UserAuthenticationDTO userAuth)
        {
            var sqlParams = new
            {
                Id = Guid.NewGuid(),
                userAuth.DisplayName,
                userAuth.IsRevoked,
                userAuth.RevokeTime
            };
            string sql = @";
                UPDATE dbo.UserAuthenticationMethods
                SET DisplayName = @DisplayName,
                    IsRevoked = @IsRevoked,
                    RevokeTime = @RevokeTime    
                WHERE Id = @Id;
            ";

            await _db.Execute(async (db) =>
            {
                await db.ExecuteAsync(sql, sqlParams);
            });
        }