Beispiel #1
0
        public async Task <object> Get()
        {
            DBSeed.Seed();

            BlogArticleRepository blogArticleRepository = new BlogArticleRepository();

            return(await blogArticleRepository.Query());
        }
 protected void Application_Start()
 {
     AreaRegistration.RegisterAllAreas();
     FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
     RouteConfig.RegisterRoutes(RouteTable.Routes);
     BundleConfig.RegisterBundles(BundleTable.Bundles);
     //Change it to your folder path
     rootPath = @"C:\Users\user\Downloads\MyMVC\blogFiles";
     if (rootPath == null)
     {
         throw new Exception("You have to set the rootPath to your blogFiles directory");
     }
     mainBlog = new BlogArticleRepository(rootPath, "blog.dat");
 }
        protected void Application_Start()
        {
            // execute configuration methods
            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            // check path ad then load the blog entries from the text file
            if (rootPath == null)
            {
                throw new Exception("You have to set the rootPath to your blogFiles directory");
            }
            mainBlog = new BlogArticleRepository(rootPath, "blog.dat");
        }