public JsonResult RemoveMyBook(string removeUserId)
        {
            var reUserId = new Guid(removeUserId);

            UCHomeBasePage   ucbBasePage = new UCHomeBasePage();
            Guid             adduser     = user.userid;
            UCHomeEntities   uc          = new UCHomeEntities();
            View_Simple_User vsu         = uc.View_Simple_User.SingleOrDefault(u => u.userid == reUserId);

            if (vsu != null)
            {
                UCHome_Attention attent =
                    uc.UCHome_Attention.FirstOrDefault(u => u.AddUser == adduser && u.AttenUser == vsu.userid);
                if (attent != null)
                {
                    uc.UCHome_Attention.DeleteObject(attent);
                    uc.SaveChanges();

                    var            client1 = new JsonServiceClient(http + "/SNSApi/");
                    DeleteAddrBook book    = new DeleteAddrBook
                    {
                        GroupID = user.userid.ToString(),
                        UID     = vsu.userid.ToString()
                    };

                    client1.Delete(book);
                }
                return(Json(true, JsonRequestBehavior.AllowGet));
            }
            return(Json(false, JsonRequestBehavior.AllowGet));
        }
示例#2
0
        public ActionResult CancelAttent(Guid AttentUser)
        {
            View_Simple_User vsu = uc.View_Simple_User.SingleOrDefault(u => u.userid == AttentUser);

            if (vsu != null)
            {
                UCHome_Attention attent =
                    uc.UCHome_Attention.FirstOrDefault(u => u.AddUser == userid && u.AttenUser == vsu.userid);
                if (attent != null)
                {
                    uc.UCHome_Attention.DeleteObject(attent);
                    uc.SaveChanges();

                    var            client1 = new JsonServiceClient(http + "/SNSApi/");
                    DeleteAddrBook book    = new DeleteAddrBook
                    {
                        GroupID = user.userid.ToString(),
                        UID     = vsu.userid.ToString()
                    };

                    client1.Delete(book);
                }
                return(Json(true, JsonRequestBehavior.AllowGet));
            }
            return(Json(false, JsonRequestBehavior.AllowGet));
        }