public SearchViewPresenter(Model.Collection c_model, SearchWindow s_view) { this.c_model = c_model; s_view.svPresenter = this; }
protected void btnCollect_Click(object sender, EventArgs e) { if (Session["LoginUser"] == null) { Response.Redirect("UserLogin.aspx?LoginInfo=请先登录!&LastFormUrl=DynamicInfo.aspx?DynamicID=" + Request.QueryString["DynamicID"]); return; } Model.Collection collection = new Model.Collection(); collection.UserNum = (Session["LoginUser"] as Model.User).UserNum; collection.DynamicID = Request.QueryString["DynamicID"]; if (btnCollect.Text == "收藏") { string result = BLL.CollectionBll.InsertCollect(collection); btnCollect.Text = "已收藏"; Response.Write("<script>alert('" + result + "')</script>"); return; } string result2 = BLL.CollectionBll.CancelFollow(collection.UserNum, collection.DynamicID); btnCollect.Text = "收藏"; Response.Write("<script>alert(" + result2 + ")</script>"); }
public static string InsertCollect(Model.Collection collection) { return(DAL.DBHelper.DataAddMethod <Model.Collection>(collection) > 0 ? "已收藏!" : "操作失败,数据库操作错误,请联系管理员"); }