コード例 #1
0
 protected void Application_Start()
 {
     AreaRegistration.RegisterAllAreas();
     GlobalConfiguration.Configure(WebApiConfig.Register);
     FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
     RouteConfig.RegisterRoutes(RouteTable.Routes);
     BundleConfig.RegisterBundles(BundleTable.Bundles);
     var dbContext = new SpaceCheeseDb();
 }
コード例 #2
0
        public ActionResult Index()
        {
            ViewBag.Title = "Home Page";

            using (var db = new SpaceCheeseDb())
            {
                var scores = db.Scores;
                ViewBag.Scores = scores.ToList().OrderBy(x => x.Moves).Take(5);
                return View();
            }
        }