diff --git a/App_Start/BundleConfig.cs b/App_Start/BundleConfig.cs deleted file mode 100644 index 13718c4..0000000 --- a/App_Start/BundleConfig.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; -using System.Web.Optimization; - -public class BundleConfig -{ - public static void RegisterBundles(BundleCollection bundles) - { - // Bundle JavaScript files. - bundles.Add(new ScriptBundle("~/bundles/scripts") - .Include("~/node_modules/jquery/dist/jquery.min.js") - .Include("~/node_modules/angular/angular.min.js") - .IncludeDirectory("~/WebApp", "*.js", false) - .IncludeDirectory("~/WebApp/Components", "*.js", true) - .IncludeDirectory("~/WebApp/Directives", "*.js", true)); - - // Bundles CSS files - bundles.Add(new StyleBundle("~/bundles/styles") - .IncludeDirectory("~/Content", "*.css", true) - .IncludeDirectory("~/WebApp", "*.css", true)); - } -} diff --git a/App_Start/RouteConfig.cs b/App_Start/RouteConfig.cs deleted file mode 100644 index 336e299..0000000 --- a/App_Start/RouteConfig.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; -using System.Web.Mvc; -using System.Web.Routing; - -namespace asp_net_angularjs -{ - public class RouteConfig - { - public static void RegisterRoutes(RouteCollection routes) - { - routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); - - routes.MapRoute( - name: "Landing", - url: "", - defaults: new { controller = "Landing", action = "Index", id = UrlParameter.Optional } - ); - } - } -} diff --git a/Controllers/LandingController.cs b/Controllers/LandingController.cs index 2888a1c..d476208 100644 --- a/Controllers/LandingController.cs +++ b/Controllers/LandingController.cs @@ -1,16 +1,12 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; -using System.Web.Mvc; +using Microsoft.AspNetCore.Mvc; namespace asp_net_angularjs.Controllers { - public class LandingController : Controller - { - public ActionResult Index() + public class LandingController : Controller { - return View(); + public IActionResult Index() + { + return View(); + } } - } } diff --git a/Global.asax b/Global.asax deleted file mode 100644 index 5a72af9..0000000 --- a/Global.asax +++ /dev/null @@ -1 +0,0 @@ -<%@ Application Codebehind="Global.asax.cs" Inherits="asp_net_angularjs.MvcApplication" Language="C#" %> diff --git a/Global.asax.cs b/Global.asax.cs deleted file mode 100644 index 4d07a6e..0000000 --- a/Global.asax.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.Web.Mvc; -using System.Web.Routing; -using System.Web.Optimization; - -namespace asp_net_angularjs -{ - public class MvcApplication : System.Web.HttpApplication - { - protected void Application_Start() - { - AreaRegistration.RegisterAllAreas(); - RouteConfig.RegisterRoutes(RouteTable.Routes); - BundleConfig.RegisterBundles(BundleTable.Bundles); - } - } -} diff --git a/Program.cs b/Program.cs new file mode 100644 index 0000000..8430366 --- /dev/null +++ b/Program.cs @@ -0,0 +1,36 @@ +using Microsoft.Extensions.FileProviders; + +var builder = WebApplication.CreateBuilder(args); + +builder.Services.AddControllersWithViews(); + +var app = builder.Build(); + +if (!app.Environment.IsDevelopment()) +{ + app.UseExceptionHandler("/Home/Error"); + app.UseHsts(); +} + +app.UseHttpsRedirection(); +app.UseStaticFiles(); + +app.UseStaticFiles(new StaticFileOptions +{ + FileProvider = new PhysicalFileProvider(Path.Combine(Directory.GetCurrentDirectory(), "WebApp")), + RequestPath = "/WebApp" +}); + +app.UseStaticFiles(new StaticFileOptions +{ + FileProvider = new PhysicalFileProvider(Path.Combine(Directory.GetCurrentDirectory(), "node_modules")), + RequestPath = "/node_modules" +}); + +app.UseRouting(); + +app.MapControllerRoute( + name: "default", + pattern: "{controller=Landing}/{action=Index}/{id?}"); + +app.Run(); diff --git a/Views/Landing/Index.cshtml b/Views/Landing/Index.cshtml index 92d72ed..a8b4e6d 100644 --- a/Views/Landing/Index.cshtml +++ b/Views/Landing/Index.cshtml @@ -1,5 +1,4 @@ -@using System.Web.Optimization @{ Layout = null; } @@ -11,15 +10,21 @@ -