Ejemplo n.º 1
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));
 }