public async Task <HttpResponseMessage> Post([FromBody] ShopSensorEvent newEvent) { await DocDBRepository <ShopSensorEvent> .CreateItemAsync(newEvent); var pushNotificationResponse = await PushNotificationService.TriggerPushNotification(newEvent.EventType, config.Notifications.HubName, config.Notifications.FullListener); HttpResponseMessage res = new HttpResponseMessage(HttpStatusCode.OK); return(res); }
public async Task <IEnumerable <ShopSensorEvent> > Get(int daysSince = 30) { return(await DocDBRepository <ShopSensorEvent> .GetItemsAsync(s => s.EventTime > DateTime.Now.AddDays(daysSince * -1))); }
public ShopSensorController(IOptions <AppConfig> optionsAccesor) { config = optionsAccesor.Value; DocDBRepository <ShopSensorEvent> .Initialize(config.DocDb.Uri, config.DocDb.Key); }