//public IActionResult index()
        //{
        //    return this.Content("i you ok");
        //}
        #endregion

        #region //r返回的是一个json
        //public IActionResult Index()
        //{
        //    var std = new Student
        //    {
        //        id = 1,
        //        FirstName = "ok",
        //        LastName = "canert"

        //};
        //    return new ObjectResult(std);
        //}
        #endregion

        #region//返回视图
        //public IActionResult index()
        //{
        //    var std = new Student
        //    {
        //        id = 1,
        //        FirstName = "ok",
        //        LastName = "canert"

        //    };
        //    return View(std);
        //}
        #endregion


        #region  返回一个集合
        public IActionResult index()
        {
            var list = _repsoitory.GetAll();

            var vms = list.Select(x => new StudentViewModel
            {
                //大括号里面可以放变量
                //格式化字符串 类似于formate
                Name = $"{x.FirstName}{x.LastName}",
                Age  = DateTime.Now.Subtract(x.BirthDate).Days / 365,
                id   = x.id,
            });

            var vm = new HomeIndexViewModel
            {
                StudentViews = vms
            };

            return(View(vm));
        }
        public IViewComponentResult invoke()
        {
            var count = _repsoitory.GetAll().Count();

            return(View("default", count));
        }