Exemplo n.º 1
0
        public async Task <IActionResult> Delete([FromBody] RegistrationData registrationData)
        {
            var platformId   = BitcornUtils.GetPlatformId(registrationData.PlatformId);
            var userIdentity = await BitcornUtils.GetUserIdentityForPlatform(platformId, _dbContext);

            if (registrationData.Auth0Id == userIdentity.Auth0Id)
            {
                await BitcornUtils.DeleteIdForPlatform(userIdentity, platformId, _dbContext);

                return(Ok());
            }
            throw new Exception("Auth0Id did not match the Auth0Id in the database for this user");
        }
        public async Task <IActionResult> Delete([FromBody] RegistrationData registrationData)
        {
            if (this.GetCachedUser() != null)
            {
                throw new InvalidOperationException();
            }
            var platformId   = BitcornUtils.GetPlatformId(registrationData.PlatformId);
            var userIdentity = await BitcornUtils.GetUserIdentityForPlatform(platformId, _dbContext);

            if (userIdentity == null)
            {
                return(StatusCode(200));
            }
            if (registrationData.Auth0Id == userIdentity.Auth0Id)
            {
                await BitcornUtils.DeleteIdForPlatform(userIdentity, platformId, _dbContext);

                return(Ok());
            }
            throw new Exception("Auth0Id did not match the Auth0Id in the database for this user");
        }