public async Task <ThemeModel> GetThemeAsync([FromBody] string id) { Console.WriteLine("Fethcing Font Style" + id); IDataGateway dataGateway = new SQLServerGateway(); IConnectionStringData connectionString = new ConnectionStringData(); IUserAccountSettingsRepository userAccountSettingsRepository = new UserAccountSettingRepository(dataGateway, connectionString); ThemeModel themeModel = new ThemeModel(); themeModel.theme = await userAccountSettingsRepository.GetThemeColorByID(Int32.Parse(id)); return(themeModel); }
public async Task <bool> ChangeThemeAsync([FromBody] ThemeModel theme) { Console.WriteLine("Font Style Changed"); IDataGateway dataGateway = new SQLServerGateway(); IConnectionStringData connectionString = new ConnectionStringData(); IUserAccountRepository userAccountRepository = new UserAccountRepository(dataGateway, connectionString); IUserAccountSettingsRepository userAccountSettingsRepository = new UserAccountSettingRepository(dataGateway, connectionString); ICryptographyService cryptographyService = new CryptographyService(userAccountRepository); IAuthenticationService authenticationService = new AuthenticationService(userAccountRepository); IAccountSettingsManager userAccountSettingsManager = new AccountSettingsManager(userAccountRepository, userAccountSettingsRepository, cryptographyService, authenticationService); bool result = await userAccountSettingsManager.ChangeThemeColorAsync(theme.id, theme.theme); return(true); }