Beispiel #1
0
        public bool Delete(UserSession user)
        {
            var connection = _context.UserConnections.Find(user.Id);
            if(connection != null)
                _context.UserConnections.Remove(connection);

            return _context.SaveChanges() > 0;
        }
Beispiel #2
0
        public ActionResult CreateSession(string videoUrl)
        {
            var model = new UserSession()
            {
                Id = Guid.NewGuid()
            };

            ViewBag.VideoUrl = videoUrl;
            return View(model);
        }
Beispiel #3
0
        public bool Update(UserSession user)
        {
            var connection = _context.UserConnections.FirstOrDefault(m => m.Id == user.Id);

            if (connection != null)
            {
                connection = user;
                return _context.SaveChanges() > 0;
            }

            return false;
        }
Beispiel #4
0
        public ActionResult CreateSession(UserSession session, string videoUrl)
        {
            if (ModelState.IsValid)
            {
                var result = repository.Create(session);

                Session["UserSession"] = session;
                HttpContext.Response.Cookies.Add(new System.Web.HttpCookie("client", session.Id.ToString()));

                return RedirectToAction("Index", "Video", new { url = videoUrl });
            }

            return View(session);
        }
Beispiel #5
0
 public bool Create(UserSession session)
 {
     var result = _context.UserConnections.Add(session);
     return _context.SaveChanges() > 0;
 }