Ejemplo n.º 1
0
        /// <summary>
        /// If the tenat is not active, activates it and returns to the list action with updated information
        /// reports any problem, otherwise
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult Activate(string id)
        {
            var tenantRegistrar = MultiTenantFactory.GetTenantRegistrar();

            tenantRegistrar.Activate(id);
            return(View());
        }
Ejemplo n.º 2
0
        /// <summary>
        /// If the tenat is inactive and is not default, deletes it and returns to the list action with updated information
        /// reports any problem, otherwise
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        /// <remarks>
        /// 1. It is not allowed to delete an ACTIVE tenant. If needed, the chosen tenant must be inctivated first.
        /// 2. It is not allowed to delete the DEFAULT tenant. If needed, another tenant must be set as the default, before deleting the chosen one.
        /// 3.There MUST at least one active tenant remaining in the list after this operation.
        /// </remarks>
        public ActionResult Unregister(string id)
        {
            var tenantRegistrar = MultiTenantFactory.GetTenantRegistrar();

            tenantRegistrar.Unregister(id);
            return(View());
        }
Ejemplo n.º 3
0
        public ActionResult MakeDefault(string id)
        {
            var tenantRegistrar = MultiTenantFactory.GetTenantRegistrar();

            tenantRegistrar.MakeDefault(id);
            return(View());
        }
Ejemplo n.º 4
0
 public void Delete(string id)
 {
     if (IsDeletable(id))
     {
         var tenantRegistrar = MultiTenantFactory.GetTenantRegistrar();
         tenantRegistrar.Unregister(id);
     }
 }
Ejemplo n.º 5
0
        public ActionResult Create(TenantCreateModel model)
        {
            // The model must contain a zip file.
            // check the zip file for validity
            // copy the zip (as a zip) file into the workspace's temp folder and provide the path
            var zipFolder = "";
            // provide the filename and the folder to the Register function. the file name must be the tenant id
            var tenantId        = "the file name";
            var tenantRegistrar = MultiTenantFactory.GetTenantRegistrar();

            tenantRegistrar.Register(tenantId, zipFolder);
            return(PartialView("_Create", model));
        }
Ejemplo n.º 6
0
        public ActionResult Edit(TenantEditModel model)
        {
            var tenantRegistrar = MultiTenantFactory.GetTenantRegistrar();

            // Make tenant to be the default!
            if (model.IsDefault)
            {
                tenantRegistrar.MakeDefault(model.Id);
            }

            if (model.Status)
            {
                tenantRegistrar.Activate(model.Id);
            }
            else
            {
                tenantRegistrar.Inactivate(model.Id);
            }

            return(Json(new { success = true }));
        }