Ejemplo n.º 1
0
        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));
        }
Ejemplo n.º 2
0
        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();
        }