//执行添加操作 public bool exectudeQuit(int clubID) { int userid = Common.User.GetUserID(Session["Username"].ToString()); //回传给前台view的model var viewModel = new QuitClub() { }; var clubBll = new BLL.clubMember(); //判断是否加入了社团 bool hasJoind = clubBll.Exist(p => (p.userid == userid & p.clubid == clubID)); if (hasJoind) { var model = clubBll.GetModel(p => (p.userid == userid & p.clubid == clubID)); clubBll.Delete(model, false); //刷新视图数据 //获取我加入的社团数 var mine = new BLL.clubMember().GetRecordCount(p => p.userid == userid); ViewBag.Mine = mine; return(true); } else { return(false); } }
public static bool HasJoinedClub(int userID, int clubID) { var bll = new BLL.clubMember(); return(bll.Exist(p => p.userid == userID & p.clubid == clubID)); }