Example #1
0
 public IActionResult OnePage(string cabh)
 {
     Model.News n = ndal.GetModelByCabh(cabh);
     if (n == null)
     {
         return(Content("无此新闻"));
     }
     return(View(n));
 }
Example #2
0
 public ActionResult Add(string cabh)
 {
     Model.News n = dal.GetModelByCabh(cabh);
     if (n == null)
     {
         Model.Category ca = cadal.GetModelByBH(cabh);
         if (ca == null)
         {
             return(Content("分类不存在"));
         }
         n = new Model.News()
         {
             title = ca.caname, body = "", cabh = ca.bh, caname = ca.caname, createtime = DateTime.Now, visitnum = 0
         };
         int newsid = dal.Add(n);
         n.id = newsid;
     }
     return(View(n));
 }