public ActionResult Create([Bind(Include = "NodeID,FromDate,ToDate,NumberOfHits")] UINode uINode) { if (ModelState.IsValid) { db.SampleNodes.Add(uINode); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(uINode)); }
public void ConnectUser(string connectionId) { var username = User.Identity.IsAuthenticated ? User.Identity.Name : null; var signalRConnection = _uiContext.SignalRConnections .SingleOrDefault(x => x.ConnectionId == connectionId); if (signalRConnection == null) { signalRConnection = new SignalRConnection { ConnectionId = connectionId, SessionId = Session.SessionID, Username = username }; _uiContext.SignalRConnections.Add(signalRConnection); } else { signalRConnection.Username = username; } _uiContext.SaveChanges(); }