Example #1
0
        public ActionResult MovieDetail(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            var _movie = movieManage.Find(id);

            if (_movie == null && _movie.Hidden == Movie.Hiddens.隐藏)
            {
                return(View("404NotFound"));
            }
            if (Session["UserID"] != null)
            {
                var _userid  = Convert.ToInt32(Session["UserID"]);
                var favCount = favoriteManage.Count(p => p.UserID == _userid && p.MovieID == id);
                ViewBag.AlreadyFavorite = (favCount == 0) ? false : true;
                var _history = historyManage.Find(id, _userid);
                if (_history == null)
                {
                    History his = new History();
                    his.ViewTime = DateTime.Now;
                    his.MovieID  = id;
                    his.UserID   = _userid;
                    var _resp = historyManage.Add(his);
                }
                else
                {
                    _history.ViewTime = DateTime.Now;
                    var _resp = historyManage.Update(_history);
                }
            }
            return(View(_movie));
        }
Example #2
0
        public ActionResult DeleteHistory(int id)
        {
            var _his = historyManage.Find(id);

            historyManage.Delete(id);
            return(Json(new { success = 1 }));
        }