예제 #1
0
 public IActionResult Index()
 {
     //List<Blog> list = dal.GetList("");
     ViewBag.calist = caDal.GetList("");
     //return View(list);
     return(View());
 }
예제 #2
0
        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));
        }
예제 #3
0
 public List <Category> GetList()
 {
     try
     {
         return(categoryDal.GetList());
     }
     catch (Exception)
     {
         return(new List <Category>());
     }
 }
예제 #4
0
        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());
        }
예제 #5
0
        /// <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));
        }
예제 #6
0
 public IActionResult Index()
 {
     ViewBag.calist   = dal.GetList("");
     ViewBag.nodejson = dal.getTreeJson();
     return(View());
 }
예제 #7
0
 public List <Category> GetList()
 {
     return(_infoDal.GetList());
 }
예제 #8
0
 public IActionResult GetList()
 {
     return(Json(new { Code = 200, data = category_dal.GetList() }));
 }
예제 #9
0
        public IEnumerable <Category> GetAll()
        {
            List <Category> cat = _categoryDal.GetList();

            return(_mapper.Map <List <Category> >(_categoryDal.GetList()));
        }