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)); }
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)); }
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)); }
/// <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)); }
/// <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)); }
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)); } }