11.1.1 Creating a CRUD Controller; Listing 11-1 The Contents of the AdminController.cs File
This commit is contained in:
parent
fe196ca256
commit
6e6ae67b21
25
SportsStore/SportsStore.WebUI/Controllers/AdminController.cs
Normal file
25
SportsStore/SportsStore.WebUI/Controllers/AdminController.cs
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
using SportsStore.Domain.Abstract;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Web;
|
||||||
|
using System.Web.Mvc;
|
||||||
|
|
||||||
|
namespace SportsStore.WebUI.Controllers
|
||||||
|
{
|
||||||
|
public class AdminController : Controller
|
||||||
|
{
|
||||||
|
private IProductRepository repository;
|
||||||
|
|
||||||
|
public AdminController(IProductRepository repo)
|
||||||
|
{
|
||||||
|
repository = repo;
|
||||||
|
}
|
||||||
|
|
||||||
|
// GET: Admin
|
||||||
|
public ActionResult Index()
|
||||||
|
{
|
||||||
|
return View(repository.Products);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -131,6 +131,7 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="App_Start\NinjectWebCommon.cs" />
|
<Compile Include="App_Start\NinjectWebCommon.cs" />
|
||||||
<Compile Include="App_Start\RouteConfig.cs" />
|
<Compile Include="App_Start\RouteConfig.cs" />
|
||||||
|
<Compile Include="Controllers\AdminController.cs" />
|
||||||
<Compile Include="Controllers\CartController.cs" />
|
<Compile Include="Controllers\CartController.cs" />
|
||||||
<Compile Include="Controllers\NavController.cs" />
|
<Compile Include="Controllers\NavController.cs" />
|
||||||
<Compile Include="Controllers\ProductController.cs" />
|
<Compile Include="Controllers\ProductController.cs" />
|
||||||
@ -167,6 +168,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Folder Include="App_Data\" />
|
<Folder Include="App_Data\" />
|
||||||
|
<Folder Include="Views\Admin\" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\SportsStore.Domain\SportsStore.Domain.csproj">
|
<ProjectReference Include="..\SportsStore.Domain\SportsStore.Domain.csproj">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user