예제 #1
0
        public async Task <ActionResult> Index()
        {
            var mvcName = typeof(Controller).Assembly.GetName();
            var isMono  = Type.GetType("Mono.Runtime") != null;

            ViewData["Version"] = mvcName.Version.Major + "." + mvcName.Version.Minor;
            ViewData["Runtime"] = isMono ? "Mono" : ".NET";

            //查询
            var query = _personService.Query(c => true);

            if (!query.Any())
            {
                _personService.Add(new Models.Persons
                {
                    Id   = Guid.NewGuid(),
                    Name = "Loongle",
                    Age  = 18
                });

                await _personService.SaveChangesAsync();
            }

            query = _personService.Query(c => true);

            ViewData["query"] = query;

            log.Debug(DateTime.UtcNow.ToString());

            return(View());
        }