public IActionResult Index() { //List<Blog> list = dal.GetList(""); ViewBag.calist = caDal.GetList(""); //return View(list); return(View()); }
public IActionResult Index() { string str = ""; Random r = new Random(); BlogDal blogdal = new BlogDal(); CategoryDal cadal = new CategoryDal(); List <Model.Category> list_ca = cadal.GetList(""); for (int i = 0; i < 102; i++) { string title = $"新闻标题{i}"; string body = title + "的内容"; Model.Category ca = list_ca[r.Next(0, list_ca.Count)]; string cabh = ca.Num, caname = ca.CaName; blogdal.Insert(new Model.Blog { Title = title, Body = body, VisitNum = r.Next(100, 999), CaNum = cabh, CaName = caname, }); } str = "添加102条测试新闻成功!"; return(Content(str)); }
public List <Category> GetList() { try { return(categoryDal.GetList()); } catch (Exception) { return(new List <Category>()); } }
public IActionResult Index(string key, string month, string caNum) { ViewBag.blogDal = bDal; ViewBag.calist = caDal.GetList(""); ViewBag.blogmonth = bDal.GetBlogMonth(); ViewBag.search_key = key; ViewBag.search_month = month; ViewBag.search_caNum = caNum; return(View()); }
/// <summary> /// show blog /// </summary> /// <param name="id"></param> /// <returns></returns> public IActionResult Show(int id) { ViewBag.blogDal = dal; ViewBag.calist = cadal.GetList(""); ViewBag.blogmonth = dal.GetBlogMonth(); Model.Blog b = dal.GetModel(id); if (b == null) { return(Content("Not Found!")); } return(View(b)); }
public IActionResult Index() { ViewBag.calist = dal.GetList(""); ViewBag.nodejson = dal.getTreeJson(); return(View()); }
public List <Category> GetList() { return(_infoDal.GetList()); }
public IActionResult GetList() { return(Json(new { Code = 200, data = category_dal.GetList() })); }
public IEnumerable <Category> GetAll() { List <Category> cat = _categoryDal.GetList(); return(_mapper.Map <List <Category> >(_categoryDal.GetList())); }