private void SaveQueryResultToDb(Stream stream) { stream.Position = 0; StreamReader reader = new StreamReader(stream); string response = reader.ReadToEnd(); var settingQueryResult = _settingQueryResultService.Get(); if (settingQueryResult == null) { settingQueryResult = new SettingQueryResult { Id = 1, LastSearchResult = response, LastSearchFilter = "" }; _settingQueryResultService.Add(settingQueryResult); } else { settingQueryResult.LastSearchResult = response; _settingQueryResultService.Update(settingQueryResult); } }
public void Update(SettingQueryResult entry) { _databaseContext.SettingQueryResults.Update(entry); _databaseContext.SaveChanges(); }
public void Add(SettingQueryResult entry) { _databaseContext.SettingQueryResults.Add(entry); _databaseContext.SaveChanges(); }