private ClientConfigurationGroup CreateClientConfiguration(ConfigurationGroupEnum configurationType) { switch (configurationType) { case ConfigurationGroupEnum.CO: return(new ClientConfigurationGroup { Language = new Language { LanguageName = ConfigurationManager.AppSettings["LanguageDefaultName"], LanguageCode = ConfigurationManager.AppSettings["LanguageDefaultCode"] }, SupportNumber = ConfigurationManager.AppSettings["COSupportNumber"], ConfigurationGroupEnum = ConfigurationGroupEnum.CO }); case ConfigurationGroupEnum.COHome: return(new ClientConfigurationGroup { Language = new Language { LanguageName = ConfigurationManager.AppSettings["LanguageDefaultName"], LanguageCode = ConfigurationManager.AppSettings["LanguageDefaultCode"] }, SupportNumber = ConfigurationManager.AppSettings["COHomeSupportNumber"], ConfigurationGroupEnum = ConfigurationGroupEnum.COHome }); } throw new NotImplementedException(); }
public ClientConfigurationGroup GetClientConfiguration(ConfigurationGroupEnum configurationType) { var clientConfiguration = _context .ClientConfigurationGroup .FirstOrDefault(x => x.ConfigurationGroupEnum == configurationType); if (clientConfiguration == null) { clientConfiguration = CreateClientConfiguration(configurationType); _context.ClientConfigurationGroup.Add(clientConfiguration); _context.SaveChanges(); } return(clientConfiguration); }