public async Task AddTriviaMessageToDatabase(TriviaMessageDto response) { using (var databaseContext = new DatabaseContext()) { var triviaMessage = new TriviaMessage { Sender = response.Sender, MessageText = response.MessageText, Timestamp = DateTime.Now, }; databaseContext.TriviaMessages.Add(triviaMessage); CleanDatabase(databaseContext); await databaseContext.SaveChangesAsync(); } }
private async Task HandleOpenSolutionAsync(object sender = null, EventArgs e = null) { var GeneralOptionsDto = await GetGeneralOptionsDtoAsync(); var shouldShowTrivia = new DecisionMaker().ShouldShowTrivia(GeneralOptionsDto); if (shouldShowTrivia) { await JoinableTaskFactory.SwitchToMainThreadAsync(); var popUpTitle = CommonConstants.GetCaption(Vsix.Name, Vsix.Version); var hiddenOptionsDto = new TriviaMessage().ShowTrivia(AppName.NumericTrivia, popUpTitle, GeneralOptionsDto.LastPopUpDateTime, GeneralOptionsDto.PopUpCountToday, GeneralOptionsDto.TimeOutInMilliSeconds, Vsix.Name); if (hiddenOptionsDto != null) { UpdateHiddenOptions(hiddenOptionsDto); } //ChaseRating(); } }