public async Task <IActionResult> NotificationsDevice(string id, [FromQuery] string token) { try { using (DbWaterRecyclingContext db = new DbWaterRecyclingContext()) { var code = await db.Devices.Where(i => i.Code.Equals(id)).FirstOrDefaultAsync(); if (code == null) { return(BadRequest()); } code.DeviceToken = token; db.Update(code); await db.SaveChangesAsync(); Notifications.Notify notify = new Notifications.Notify(); notify.NotifyNewDevice(code); return(Ok(10)); } } catch (Exception ex) { return(StatusCode((int)HttpStatusCode.InternalServerError, ex)); } }
string GetnewProcess(Device device) { Notifications.Notify notify = new Notifications.Notify(); notify.NewEvent(device); return(Guid.NewGuid().ToString().Substring(0, 6)); }