private static RatePushNotification CreateRatePushNotificationModel(RoborHistoric result, RoborHistoric robors) { var push = new RatePushNotification() { Data = DateTime.Today.ToString("d"), Robor3M = result.Robor3M, Robid3M = result.Robid3M, }; push.Delta = push.Robor3M - robors.Robor3M; return(push); }
private static void SendRoborPushNotification(TraceWriter log, RatePushNotification ratePush, RoborHistoric recentRobor) { log.Info($"Push notification {ratePush}"); var json = JsonConvert.SerializeObject(ratePush, Formatting.None, new JsonSerializerSettings() { ContractResolver = new CamelCasePropertyNamesContractResolver() }); if (!ratePush.SendRoborPush) { return; } if (recentRobor.Data.Date == DateTime.Today.Date) { return; } log.Info($"Push notification json {json}"); using (var client = new HttpClient()) { var jmecherie = client.PostAsync(Environment.GetEnvironmentVariable("PushHttp"), new StringContent(json, Encoding.UTF8, "application/json")).Result; } }