Ejemplo n.º 1
0
        public async Task <ActionResult> DeProvisionPowerBITenants(CustomerDbCredsInputDto model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            try
            {
                var(succeed, message) = await
                                        _provisionPowerBITenantsService.DeProvision(model.GetConnectionString());

                if (succeed)
                {
                    return(Ok());
                }
                else
                {
                    return(StatusCode(StatusCodes.Status500InternalServerError, message));
                }
            }
            catch (Exception ex)
            {
                _logger.LogError(ex.StackTrace);
                return(StatusCode(StatusCodes.Status500InternalServerError, "Something went wrong!"));
            }
        }
Ejemplo n.º 2
0
        public async Task <ActionResult> ValidateCustomerDbInfo(CustomerDbCredsInputDto model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            try
            {
                var succeed = await
                              _provisionPowerBITenantsService.ValidateDBInfo(model.GetConnectionString());

                if (succeed)
                {
                    return(Ok());
                }
                else
                {
                    return(StatusCode(StatusCodes.Status404NotFound, "Database credentials are not valid."));
                }
            }
            catch (Exception ex)
            {
                _logger.LogError(ex.StackTrace);
                return(StatusCode(StatusCodes.Status500InternalServerError, "Something went wrong!"));
            }
        }