Exemple #1
0
        /// <summary>
        /// Inserts an language depending if it already exists
        /// </summary>
        private void AddLanguageIfNotExists(ApplicationLanguage language)
        {
            if (_context.Languages.Any(l =>
                                       l.TenantId == language.TenantId && l.Name == language.Name)
                )
            {
                return;
            }

            _context.Languages.Add(language);
            _context.SaveChanges();
        }
Exemple #2
0
        /// <summary>
        /// Creates default editions
        /// </summary>
        private void CreateEditions()
        {
            var defaultEdition = _context.Editions.FirstOrDefault(e =>
                                                                  e.Name == EditionManager.DefaultEditionName
                                                                  );

            if (defaultEdition == null)
            {
                defaultEdition = new Edition
                {
                    Name        = EditionManager.DefaultEditionName,
                    DisplayName = EditionManager.DefaultEditionName
                };

                _context.Editions.Add(defaultEdition);
                _context.SaveChanges();
            }
        }
        /// <summary>
        /// Creates default tenants
        /// </summary>
        private void CreateTenants()
        {
            // Default tenant
            var defaultTenant = _context.Tenants.FirstOrDefault(t =>
                                                                t.TenancyName == Tenant.DefaultTenantName
                                                                );

            if (defaultTenant == null)
            {
                _context.Tenants.Add(
                    new Tenant
                {
                    TenancyName = Tenant.DefaultTenantName,
                    Name        = Tenant.DefaultTenantName
                }
                    );
                _context.SaveChanges();
            }
        }