Finished 'Views in ASP.NET MVC Application'

This commit is contained in:
jason.zhu 2021-06-10 15:48:05 +10:00
parent a556642489
commit 483fe19002
3 changed files with 21 additions and 3 deletions

View File

@ -9,9 +9,9 @@ namespace FirstMVCDemo.Controllers
public class HomeController : Controller public class HomeController : Controller
{ {
// GET: Home // GET: Home
public string Index(string id, string name) public ActionResult Index()
{ {
return "Id = " + id + ", Name = " + Request.QueryString["name"]; return View();
} }
} }
} }

View File

@ -102,6 +102,7 @@
<ItemGroup> <ItemGroup>
<Content Include="Views\web.config" /> <Content Include="Views\web.config" />
<None Include="packages.config" /> <None Include="packages.config" />
<Content Include="Views\Home\Index.cshtml" />
<None Include="Web.Debug.config"> <None Include="Web.Debug.config">
<DependentUpon>Web.config</DependentUpon> <DependentUpon>Web.config</DependentUpon>
</None> </None>
@ -112,7 +113,6 @@
<ItemGroup> <ItemGroup>
<Folder Include="App_Data\" /> <Folder Include="App_Data\" />
<Folder Include="Models\" /> <Folder Include="Models\" />
<Folder Include="Views\Home\" />
</ItemGroup> </ItemGroup>
<PropertyGroup> <PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion> <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>

View File

@ -0,0 +1,18 @@

@{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>Index</title>
</head>
<body>
<div>
<h1>Index View Coming From Views/Home Folder</h1>
</div>
</body>
</html>