public void SetNudgeResult(Guid notificationId, NudgeResult nudgeResult) { if (notificationId == Guid.Empty) { this.logger.LogWarning("Guid is empty"); return; } var notification = this.NotificationRepository.Get(notificationId); var nudge = this.NudgeRepository.Get(notification.NudgeId); nudge.Result = nudgeResult; this.NudgeRepository.Update(nudge); this.NotificationRepository.Update(notification); }
public Guid Insert(NudgeResult result, Guid userId, WeatherDto forecast, TripDto trip) { var entity = new NudgeEntity { UserId = userId, Result = result, TransportationType = trip.TransportationType, Distance = trip.Distance, Duration = trip.Duration, SkyCoverage = forecast.SkyCoverage, WeatherProbability = forecast.Probabilities, ReafFeelTemperature = forecast.RealFeelTemperature, Temperature = forecast.Temperature, RoadCondition = forecast.RoadCondition, DateTime = forecast.DateTime, WindCondition = forecast.WindCondition }; this.Insert(entity); return(entity.Id); }
public void AddNudge(Guid userId, NudgeResult nudgeResult, WeatherDto forecast, TripDto trip) { this.NudgeRepository.Insert(nudgeResult, userId, forecast, trip); try { this.AnonymousNudgeOracleRepository.Insert(new OracleNudgeEntity { ActualTransportationType = trip.TransportationType, PrecipitationProbability = forecast.PrecipitationProbability, Result = NudgeResult.Successful, RoadCondition = forecast.RoadCondition, SkyCoverage = forecast.SkyCoverage, Temperature = forecast.Temperature, Wind = forecast.Wind }); } catch (Exception ex) { Console.WriteLine("Error while inserting into oracle database."); Console.WriteLine(ex.Message); } }
public IActionResult Set(Guid notificationId, NudgeResult nudgeResult) { this.PushNotificationLogic.SetNudgeResult(notificationId, nudgeResult); return(this.Ok()); }