Beispiel #1
0
 public void Put(Tenant tenant)
 {
     try
     {
         Context.Update(tenant);
     }
     catch (Exception)
     {
         throw;
     }
 }
Beispiel #2
0
        public IHttpActionResult Put(
            [FromUri] int id,
            [FromBody] CreateTenantModel command)
        {
            if (command == null || !ModelState.IsValid)
            {
                return(this.Error().InvalidParameters("Tenant body parameters missing"));
            }
            if (command.TenantDbProvider == null || command.TenantDbConfiguration == null)
            {
                return(this.Error().InvalidParameters("Tenant Db information missing"));
            }

            var tenant = _tenantsRepository.GetById(id);

            tenant.Change(command.Name,
                          command.DefaultTheme,
                          DatabaseProviderConfiguration.Create(command.TenantDbProvider, command.TenantDbConfiguration));
            _tenantsRepository.Update(tenant);
            _tenantsRepository.SaveChanges();
            var tenantModel = _mapper.Map <TenantModel>(tenant);

            return(Ok(tenantModel));
        }