Ejemplo n.º 1
0
        public IActionResult Index()
        {
            List <Model.Blog> list = dal.GetList("1=1 order by sort asc,id desc");

            ViewBag.calist = cadal.GetList("");
            return(View(list));
        }
 // GET: Admin/Blog
 public ActionResult Index()
 {
     ViewBag.calist = cadal.GetList("");
     return(View());
     // List<Model.Blog> list = dal.GetList("");
     //return View(list);
 }
Ejemplo n.º 3
0
        public IActionResult Index()
        {
            ViewBag.calist = cadal.GetList("pbh='01'");
            //List<Model.Blog> list = dal.GetList("1=1 order by sort asc,id desc");

            //return View(list);
            return(View());
        }
Ejemplo n.º 4
0
 public IActionResult Index(string cate, string month, string key)
 {
     ViewBag.blogdal   = blogdal;
     ViewBag.CateNo    = cate;
     ViewBag.Month     = month;
     ViewBag.Key       = key;
     ViewBag.blogmonth = blogdal.GetBlogMonth();
     ViewBag.calist    = catedal.GetList("");
     return(View());
 }
Ejemplo n.º 5
0
        // GET: /<controller>/
        public IActionResult Index()
        {
            var str     = "";
            var cateDal = new DAL.CategoryDAL();

            str = "新增的分类返回的值:" + cateDal.Insert(new Model.Category()
            {
                CateName = "newcatename"
            }).ToString() + "\r\n";

            str = "删除Id==7返回的值:" + cateDal.Delete(7) + "\r\n";

            Model.Category cate = cateDal.GetModel(8);
            if (cate != null)
            {
                cate.CateName = "新修改的名称" + DateTime.Now;
                str          += "修改Id==8返回的值:" + cateDal.Update(cate) + "\r\n";
            }

            List <Model.Category> list = cateDal.GetList("");

            foreach (var item in list)
            {
                str += $"分类ID:{item.Id},分类名称:{item.CateName}\r\n";
            }
            return(Content(str));
        }
Ejemplo n.º 6
0
        public IActionResult Index()
        {
            ///1、测试增
            string str = "";

            mhq.Blog.DAL.CategoryDAL cadal = new DAL.CategoryDAL();
            str += "新增的ID值:" + cadal.insert(new Model.Category()
            {
                caname = "caname", bh = "01", pbh = "01", remark = "01"
            }) + "<hr />";

            //2、测试删
            bool b = cadal.Delete(3);

            str += "删除ID=7的结果:" + b + "<hr />";

            //3、测试修改
            ////先取出数据
            Model.Category ca = cadal.Getmodel(3);
            if (ca != null)
            {
                ca.caname = "新修改的名称" + DateTime.Now;
                bool b2 = cadal.update(ca);
                str += "修改ID=8的结果:" + b2 + "<hr />";
            }
            ///4、测试查询
            List <Model.Category> list = cadal.GetList("");

            foreach (var item in list)
            {
                str += $"<div>分类id:{item.id},分类名称:{item.caname}</div >";
            }

            return(Content(str));
        }
Ejemplo n.º 7
0
 public IActionResult Index()
 {
     #region 生成节点数据JSON
     ViewBag.nodejson = dal.GetTreeJson();
     #endregion
     ViewBag.calist = dal.GetList("");
     return(View());
 }
Ejemplo n.º 8
0
 public IActionResult Index(string number)
 {
     DAL.CategoryDAL cadal = new DAL.CategoryDAL();
     DAL.BlogDAL     dal   = new DAL.BlogDAL();
     ViewBag.calist   = cadal.GetList("");
     ViewBag.datelist = dal.GetCreatDateGroup();
     return(View());
 }
Ejemplo n.º 9
0
        public IActionResult Index()
        {
            //生成节点数据JSON
            ViewBag.nodejson = dal.GettreeJson();

            ViewBag.calist = dal.GetList("");

            return(View());
        }
Ejemplo n.º 10
0
 public IActionResult Add(int?id)
 {
     ViewBag.calist = cadal.GetList("");
     Model.Blog m = new Model.Blog();
     if (id != null)
     {
         m = dal.Getmodel(id.Value);
     }
     return(View(m));
 }
Ejemplo n.º 11
0
        public IActionResult Index(string key, string month, string cabh)
        {
            ViewBag.blogdal = bdal;

            ViewBag.calist    = cadal.GetList("");
            ViewBag.blogmonth = bdal.GetBlogMonth();

            ViewBag.search_key   = key;
            ViewBag.search_month = month;
            ViewBag.search_cabh  = cabh;

            return(View());
        }
Ejemplo n.º 12
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));
        }
Ejemplo n.º 13
0
        // GET: /<controller>/
        public IActionResult Index()
        {
            List <Model.Category>       list      = cadal.GetList("ParentCate='0'");
            List <Model.TreeJson_LayUI> list_tree = new List <Model.TreeJson_LayUI>();

            foreach (var item in list)
            {
                List <Model.TreeJson_LayUI> list_sub   = new List <Model.TreeJson_LayUI>();
                List <Model.Category>       list_casub = cadal.GetList($"ParentCate='{item.CateNo}'");
                foreach (var item_sub in list_casub)
                {
                    list_sub.Add(new Model.TreeJson_LayUI()
                    {
                        name = item_sub.CateName, caid = item_sub.Id
                    });
                }
                list_tree.Add(new Model.TreeJson_LayUI()
                {
                    name = item.CateName, href = "", spread = true, children = list_sub, caid = item.Id
                });
            }
            ViewBag.treejson = Newtonsoft.Json.JsonConvert.SerializeObject(list_tree);
            return(View());
        }
Ejemplo n.º 14
0
        public IActionResult Index()
        {
            string str = "";

            Random r = new Random();
            List <Model.Category> list = cadal.GetList("");

            for (int i = 0; i < 100; i++)
            {
                Model.Category ca = list[r.Next(0, list.Count)];
                Model.Blog     m  = new Model.Blog
                {
                    Title    = $"第{i}条数据",
                    Body     = $"第{i}条数据的内容",
                    CaBh     = ca.Bh,
                    CaName   = ca.CaName,
                    VisitNum = r.Next(100, 999)
                };

                bdal.Insert(m);
            }
            str = "添加100条数据成功";

            //str = "新增返回的值" + cadal.Insert(new Model.Category() {  CaName="789"}) + "<hr />";
            //bool b = cadal.Delete(7);
            //str += "删除ID=7的数据" + b + "<hr />";
            //Model.Category ca = cadal.GetModel(8);
            //if(ca!=null)
            //{
            //    ca.CaName = "新修改的名字" + DateTime.Now;
            //    bool b2 = cadal.Update(ca);
            //    str += "修改ID=8的实体类结果" + b2 + "<hr />";
            //}

            //List<Model.Category> list = cadal.GetList("");
            //foreach (var item in list)
            //{
            //    str += $"<div>分类ID:{item.Id},分类名称:{item.CaName}</div>";
            //}
            return(Content(str));
        }
Ejemplo n.º 15
0
        public IActionResult Index(string key, string month, string cabh)
        {
            ViewBag.blogdal = bdal;

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

            ViewBag.search_key   = key;
            ViewBag.search_month = month;
            ViewBag.search_cabh  = cabh;

            string ip1 = HttpContext.Request.Headers["X-Real-IP"]; //取IP,NGINX中的配置里要写上

            //var feature = HttpContext.Features.Get<IHttpConnectionFeature>();
            //string ip2 = feature.RemoteIpAddress.ToString();

            //string ip3 = HttpContext.Request.Headers["X-Forwarded-For"];

            //string all_header = "";
            //foreach (var item in HttpContext.Request.Headers.Keys)
            //{
            //    all_header += item + " → "+ HttpContext.Request.Headers[item];
            //}



            string ipfile    = hostingEnv.WebRootPath + $"{Path.DirectorySeparatorChar}upload{Path.DirectorySeparatorChar}qqwry.dat"; //IP纯真库物理路径
            string ipaddress = string.IsNullOrEmpty(ip1)?"":  Tool.GetIPAddress(ip1, ipfile);                                         //查IP纯真库

            logdal.Insert(new Model.Log
            {
                Type      = 1,
                UserId    = 0,
                UserName  = "******",
                Remark    = "访客登录 ",
                Ip        = ip1,
                IpAddress = ipaddress
            });

            return(View());
        }
Ejemplo n.º 16
0
        public IActionResult Index()
        {
            string str = "";
            Random rd  = new Random();

            DAL.CategoryDAL cadal = new DAL.CategoryDAL();
            DAL.BlogDAL     bdal  = new DAL.BlogDAL();

            var calist = cadal.GetList("");

            for (int i = 0; i < 100; i++)
            {
                string         title        = $"英雄联盟比赛{i}";
                string         body         = title + "的内容";
                Model.Category m            = calist[rd.Next(0, calist.Count())];
                string         number       = m.Number;
                string         categoryName = m.CategoryName;
                bdal.Insert(new Model.Blog()
                {
                    Title = title, Body = body, CategoryName = categoryName, CategoryNum = number
                });
            }
            str = "添加100条数据";
            //str += "新增的insert方法返回的值" + cadal.Insert(new Model.Category { CategoryName = "newca"}) + "<hr/>";

            //str += "删除ID=11的数据值"+ cadal.Delete(11) + "<hr/>";

            //Model.Category ca = cadal.GetModel(10);

            //if (ca != null) {
            //    ca.CategoryName = "asadad";
            //    str += "更新ID=10的数据值" + cadal.Update(ca) + "<hr/>";
            //}

            //List<Model.Category> list = cadal.GetList("");
            //foreach(var item in list){
            //    str += $"<div>分类ID:{item.Id},分类名称:{item.CategoryName}</div>";
            //}
            return(Content(str));
        }
Ejemplo n.º 17
0
 public IActionResult Index()
 {
     ViewBag.calist = cadal.GetList("");
     return(View());
 }
Ejemplo n.º 18
0
 // GET: /<controller>/
 public IActionResult Index()
 {
     ViewBag.calist = catedal.GetList("ParentCate='0' ORDER BY CateName");
     return(View());
 }