Пример #1
0
        public async Task <ActionResult <bool> > Create([FromBody] CreateModule createModule)
        {
            var tenant = (await _tenantService.GetTenantFromHostAsync());

            if (tenant != null)
            {
                Console.WriteLine($"creating module for {tenant.Id} : {tenant.Name}");
                using (var context = _tenantService.CreateContext(tenant))
                {
                    var moduleService = new ModuleService(context);
                    return(Ok(await moduleService.CreateModuleAsync(createModule)));
                }
            }

            return(BadRequest("Tenant doesn't exist"));
        }