15.1.1 Creating the Example Controller; Listing 15-3 The Contents of the AdminController.cs File

This commit is contained in:
Jason Zhu 2021-09-30 22:42:48 +10:00
parent 67c6858c48
commit afb82add7b
2 changed files with 21 additions and 0 deletions

View File

@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace UrlsAndRoutes.Controllers
{
public class AdminController : Controller
{
// GET: Admin
public ActionResult Index()
{
ViewBag.Controller = "Admin";
ViewBag.Action = "Index";
return View("ActionName");
}
}
}

View File

@ -93,6 +93,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="App_Start\RouteConfig.cs" />
<Compile Include="Controllers\AdminController.cs" />
<Compile Include="Controllers\HomeController.cs" />
<Compile Include="Global.asax.cs">
<DependentUpon>Global.asax</DependentUpon>
@ -112,6 +113,7 @@
<ItemGroup>
<Folder Include="App_Data\" />
<Folder Include="Models\" />
<Folder Include="Views\Admin\" />
<Folder Include="Views\Home\" />
</ItemGroup>
<PropertyGroup>