private async Task saveEODdata(string data) // convert to json { try { EndOfDayData eodData = EndOfDayData.Deserialize(data); bool idExists = _stockScreenerService.EODIdExists(eodData.Id); if (idExists) { await _stockScreenerService.UpdateEODdata(eodData.Id, eodData); } _stockScreenerService.Create(eodData); } catch (Exception ex) { if (ex is System.ArgumentNullException || ex is System.TimeoutException) { Console.WriteLine("Exception " + ex); } Console.WriteLine("Exception " + ex); } await Task.Delay(100); // Indicate lock stream await _stockHandler.Clients.All.lockStream(serviceWorker.API_REQUESTS, true); }
public HttpStatusCode saveNotifications(string query) // convert to json { var response = new HttpResponseMessage(); HttpStatusCode res; try { Notifications notifications = Notifications.Deserialize(query); bool idExists = _stockScreenerService.NotificationsIdExists(notifications.Id); if (idExists) { return(HttpStatusCode.Ambiguous); } Notifications list = _stockScreenerService.Create(notifications); res = response.StatusCode; } catch (Exception ex) { if (ex is System.ArgumentNullException) { Console.WriteLine("Exception " + ex); } Console.WriteLine("Exception " + ex); res = response.StatusCode; } return(res); }