public IActionResult Remove(string portalName)
        {
            if (string.IsNullOrEmpty(portalName))
            {
                return(BadRequest(new
                {
                    errors = "portalName is required."
                }));
            }

            var tenant = HostedSolution.GetTenant(portalName.Trim());

            if (tenant == null)
            {
                return(BadRequest(new
                {
                    errors = "Tenant not found."
                }));
            }

            HostedSolution.RemoveTenant(tenant);

            return(Ok(new
            {
                errors = "",
                tenant = ToTenantWrapper(tenant)
            }));
        }
Exemple #2
0
        public IActionResult Remove([FromQuery] TenantModel model)
        {
            if (!CommonMethods.GetTenant(model, out var tenant))
            {
                Log.Error("Model without tenant");

                return BadRequest(new
                {
                    error = "portalNameEmpty",
                    message = "PortalName is required"
                });
            }

            if (tenant == null)
            {
                Log.Error("Tenant not found");

                return BadRequest(new
                {
                    error = "portalNameNotFound",
                    message = "Portal not found"
                });
            }

            HostedSolution.RemoveTenant(tenant);

            return Ok(new
            {
                tenant = CommonMethods.ToTenantWrapper(tenant)
            });
        }