コード例 #1
0
 public IActionResult Add(int?id)
 {
     ViewBag.calist = cadal.GetList("pbh='01'");
     Model.Blog m = new Model.Blog();
     if (id != null)
     {
         m = dal.GetModel(id.Value);
     }
     return(View(m));
 }
コード例 #2
0
        public ActionResult Show(int id)
        {
            ViewBag.blogdal = dal;

            //  ViewBag.calist = cadal.GetIndexLeft_Ca();
            Model.Blog b = dal.GetModel(id);
            if (b == null)
            {
                return(Content("找不到该博客"));
            }
            return(View(b));
        }
コード例 #3
0
ファイル: BlogController.cs プロジェクト: Run2948/NNBlog
        public IActionResult Show(int id)
        {
            Model.Blog blog = blogdal.GetModel(id);
//            if (blog == null)
//            {
//                return Content("找不到该博客!");
//            }
            ViewBag.blogdal   = blogdal;
            ViewBag.calist    = catedal.GetList("");
            ViewBag.blogmonth = blogdal.GetBlogMonth();
            return(View(blog));
        }
コード例 #4
0
 /// <summary>
 /// 新增编辑博客页面
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public IActionResult Add(int?id)
 {
     ViewBag.calist = catedal.GetList("ParentCate='0' ORDER BY CateName");
     Model.Blog b = new Model.Blog()
     {
         Id = 0,
     };
     if (id != null)
     {
         b = blogdal.GetModel(id.Value);
     }
     return(View(b));
 }
コード例 #5
0
        /// <summary>
        /// 显示博客
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public IActionResult Show(int id)
        {
            ViewBag.blogdal = dal;

            ViewBag.calist    = cadal.GetList("pbh='01'");
            ViewBag.blogmonth = dal.GetBlogMonth();

            Model.Blog b = dal.GetModel(id);
            if (b == null)
            {
                return(Content("找不到该博客!"));
            }
            return(View(b));
        }
コード例 #6
0
ファイル: BlogController.cs プロジェクト: Backtomm/MyBlogDemo
 public IActionResult Show(int id)
 {
     Model.Blog b = dal.GetModel(id);
     if (b == null)
     {
         return(Content("找不到该博客!"));
     }
     else
     {
         Model.Blog blog = new Model.Blog {
             Id           = b.Id,
             CreateDate   = b.CreateDate,
             Title        = b.Title,
             Body         = b.Body,
             CategoryName = b.CategoryName,
             CategoryNum  = b.CategoryNum
         };
         return(View(blog));
     }
 }