public IHttpActionResult UpdateStatus(SwitchStatusModel model) { //Thread.Sleep(2000); var result = _switchService.UpdateStatus(User.Identity.GetUserId(), model.SwitchId, model.Status); var @switch = _switchService.GetSimplifiedSwitch(User.Identity.GetUserId(), model.SwitchId); var message = new WebSocketMessage(WebSocketMessageType.WebSwitchStatusUpdate); message.Message = @switch; message.BroadcastType = WebSocketBroadcastType.All; var client = LynexWebSocketHandler.GetWebSocketSession(@switch.SiteId); if (client != null) { client.Broadcast(JsonConvert.SerializeObject(@switch)); } var obj = new { Success = true, Message = "", Results = result, }; return(Ok(obj)); }
public IHttpActionResult UpdateStatus(SwitchStatusModel model) { //Thread.Sleep(2000); var result = _switchService.UpdateStatus(User.Identity.GetUserId(), model.SwitchId, model.Status); var obj = new { Success = true, Message = "", Result = result, }; return(Ok(obj)); }