Exemplo n.º 1
0
        public ActionResult DeleteToFollow(int id = 0)
        {
            UC_Follow uf = db.UC_Follow.Find(id);

            db.UC_Follow.Remove(uf);
            db.SaveChanges();
            return(RedirectToAction("FollowList"));
        }
Exemplo n.º 2
0
        //public void AddFollow(int userID, int classID)
        //{
        //    UC_Follow follow = Check(userID, classID);
        //    if (follow == null)
        //    {
        //        follow = new UC_Follow();
        //        follow.UserID = userID;
        //        follow.ClassID = classID;
        //        db.UC_Follow.Add(follow);
        //    }
        //    db.SaveChanges();
        //}

        public string AddFollow(int userID, int classID)
        {
            UC_Follow follow = Check(userID, classID);

            if (follow == null)
            {
                follow         = new UC_Follow();
                follow.UserID  = userID;
                follow.ClassID = classID;
                db.UC_Follow.Add(follow);
                db.SaveChanges();
                return("成功加入收藏");
            }
            return("已收藏此課程");
        }