Exemplo n.º 1
0
        public ActionResult AddFriend(int FriendID)
        {
            Friend entity = new Friend();

            entity.FriendID   = FriendID;
            entity.UserInfoID = LoginUser.ID;
            entity.DelFlag    = true;
            entity.RegTime    = DateTime.Now;
            entity.Status     = 1;
            var user = FriendService.GetEntity(u => u.FriendID == FriendID && u.UserInfoID == LoginUser.ID).FirstOrDefault();

            if (user == null)
            {
                FriendService.Add(entity);
                return(Json(new { status = 1, msg = "成功" }));
            }
            return(Json(new { status = 0, msg = "你们已经是好友了!!" }));
        }