public string UserFollow(string myUserNum, string otherUserNum) { Model.Follow follow = new Model.Follow(); follow.FollowUserNum = myUserNum; follow.BeUserNum = otherUserNum; return(BLL.FollowBll.InsertFollow(follow)); }
protected void btnFollow_Click(object sender, EventArgs e) { if (Session["LoginUser"] == null) { Response.Redirect("UserLogin.aspx?LoginInfo=请先登录!&LastFormUrl=DynamicInfo.aspx?DynamicID=" + Request.QueryString["DynamicID"]); return; } Model.Follow follow = new Model.Follow(); follow.FollowUserNum = (Session["LoginUser"] as Model.User).UserNum; follow.BeUserNum = BLL.UserBll.GetUserByDynamicID(Request.QueryString["DynamicID"]).UserNum; if (btnFollow.Text == "关注") { string result = BLL.FollowBll.InsertFollow(follow); btnFollow.Text = "已关注"; Response.Write("<script>alert('" + result + "')</script>"); return; } string result2 = BLL.FollowBll.CancelFollow(follow.FollowUserNum, follow.BeUserNum); btnFollow.Text = "关注"; Response.Write("<script>alert('" + result2 + "')</script>"); }
public static string InsertFollow(Model.Follow follow) { return(DAL.DBHelper.DataAddMethod <Model.Follow>(follow) > 0 ? "已关注!" : "操作失败,数据库操作错误,请联系管理员"); }