public ActionResult MyForumIndex(HostModel hm) { if (ModelState.IsValid) { int id = Convert.ToInt32(hm.Htype); //根据小类型编号查找对应大类型 var big = adb.SmallTypes.Where(a => a.Id == id).FirstOrDefault(); ForumHost fh = new ForumHost { Id = BackIdService <ForumReply> .Instance.NewId(), Fcontent = hm.Hcontent, Fname = hm.Title, FDate = System.DateTime.Now.ToString(), FuserName = User.Identity.Name, Smalltype = Convert.ToInt32(hm.Htype), Bigtype = big.BigType }; bool r = dbm.AddHost(fh); if (r) { ViewBag.msg2 = "添加成功"; } myHost(); selectList(); return(View(r ? null : hm)); } return(View(hm)); }
public bool updateHost(ForumHost f) { fh.SetCtx(db); return(fh.Update(f)); }
//添加主贴 public bool AddHost(ForumHost f) { fh.SetCtx(db); return(fh.Add(f)); }
//删除主贴 public bool DeleteFHosts(ForumHost f) { fh.SetCtx(db); return(fh.Delete(f)); }