예제 #1
0
 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));
 }
예제 #2
0
 public bool updateHost(ForumHost f)
 {
     fh.SetCtx(db);
     return(fh.Update(f));
 }
예제 #3
0
 //添加主贴
 public bool AddHost(ForumHost f)
 {
     fh.SetCtx(db);
     return(fh.Add(f));
 }
예제 #4
0
 //删除主贴
 public bool DeleteFHosts(ForumHost f)
 {
     fh.SetCtx(db);
     return(fh.Delete(f));
 }