예제 #1
0
        private static ITenant AddTenantToDb(string key, string name, string desciption, string host, ITenantRepository tenantRepository)
        {
            var existing = tenantRepository.GetAllTenants().FirstOrDefault(t => t.Key.Equals(key, StringComparison.InvariantCultureIgnoreCase));

            if (existing != null)
            {
                return(existing);
            }
            var tenant = new Tenant
            {
                Active      = true,
                TenantId    = -1,
                Name        = name,
                Key         = key,
                Host        = host,
                Description = desciption
            };

            return(tenantRepository.CreateOrUpdate(tenant));
        }