Ejemplo n.º 1
0
        public ApAddApplicationTenantsResponse AddApplicationTenants(ApAddApplicationTenantsRequest request)
        {
            Log.Debug(this, "AddApplicationTenants()");
            try
            {
                Authenticate(request);
                Application application = FindApplication(request.ApplicationId);
                if (application != null)
                {
                    if (application.Tenants == null)
                        application.Tenants = request.Tenants;
                    else
                        application.Tenants.AddRange(request.Tenants);

                    application.RowState = EntityState.Modified;
                    Database.GetInstance().Commit();

                    foreach (Tenant tenant in request.Tenants)
                        Log.Debug(this, "Tenant added: " + application + " " + tenant);
                }

                ApAddApplicationTenantsResponse response = new ApAddApplicationTenantsResponse();
                return response;
            }
            catch (Exception e)
            {
                Log.Error(this, e);
                throw e;
            }
        }
Ejemplo n.º 2
0
 public ActionResult AddApplicationTenant(Tenant tenant)
 {
     try
     {
         ApAddApplicationTenantsRequest request = new ApAddApplicationTenantsRequest(Credentials);
         request.ApplicationId = tenant.ApplicationId;
         List<Tenant> tenants = new List<Tenant>();
         tenants.Add(tenant);
         request.Tenants = tenants;
         EndPoints.ApDashboardService.AddApplicationTenants(request);
         return RedirectToAction("ApplicationInfo", new { applicationId = tenant.ApplicationId });
     }
     catch (Exception e)
     {
         return ShowError(e);
     }
 }