Esempio n. 1
0
        public async Task <IActionResult> Create([DataSourceRequest] DataSourceRequest request)
        {
            var model = new Tenant();

            if (ModelState.IsValid)
            {
                await this.TryUpdateModelAsync <TenantViewModel, Tenant>(model);

                if (options.Value.UseExplicitTenantPasswords)
                {
                    model.TenantPassword = Convert.ToBase64String(AesEncryptor.CreateKey());
                }

                db.Tenants.Add(model);

                await db.SaveChangesAsync();
            }

            return(Json(await new[] { model.ToViewModel <Tenant, TenantViewModel>() }.ToDataSourceResultAsync(request, ModelState)));
        }