Skip to content
Browse files

added users infrastructure

  • Loading branch information...
1 parent 3fe14bf commit b48a7924b524ee2e2c2871681ed95f36fffe8b91 @devinrader devinrader committed Dec 22, 2011
View
42 Website/Areas/Admin/Controllers/UsersController.cs
@@ -0,0 +1,42 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+using System.Web.Mvc;
+using Ebuy.DataAccess;
+using AutoMapper;
+using Ebuy.Website.Areas.Admin.Models;
+
+namespace Ebuy.Website.Areas.Admin.Controllers
+{
+ public class UsersController : Controller
+ {
+ private readonly IRepository _repository;
+
+ public UsersController(IRepository repository)
+ {
+ _repository = repository;
+ }
+
+ public ActionResult Index(int page = 0, int pageSize = 25)
+ {
+ var users = _repository.All<User>(page, pageSize);
+
+ var viewModel = users.Select(Mapper.DynamicMap<UserViewModel>);
+
+ return View("Users", viewModel);
+ }
+
+ public new ActionResult User(string key)
+ {
+ var auction = _repository.Single<Auction>(key);
+
+ if (auction == null)
+ return View("NotFound");
+
+ var viewModel = Mapper.DynamicMap<UserViewModel>(auction);
+ return View("User", viewModel);
+ }
+
+ }
+}
View
11 Website/Areas/Admin/Models/UserViewModel.cs
@@ -0,0 +1,11 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+
+namespace Ebuy.Website.Areas.Admin.Models
+{
+ public class UserViewModel
+ {
+ }
+}
View
5 Website/Areas/Admin/Views/Users/User.cshtml
@@ -0,0 +1,5 @@
+@{
+ ViewBag.Title = "User";
+}
+
+<h2>User</h2>
View
23 Website/Areas/Admin/Views/Users/Users.cshtml
@@ -0,0 +1,23 @@
+@model IEnumerable<Ebuy.Website.Areas.Admin.Models.UserViewModel>
+<link href="@Url.Content("~/Content/product.css")" rel="stylesheet" type="text/css" />
+@{
+ ViewBag.Title = "Users";
+}
+<h2>Users</h2>
+<div class="container">
+ <header>
+ <h3>
+ Users</h3>
+ <hr />
+ </header>
+ <div class="container clear-fix">
+ <ul id="users" class="list" data-role="listview">
+ @foreach (var user in Model)
+ {
+ <li class="listitem">
+ @*@Html.Partial("_AuctionTile", user)*@
+ </li>
+ }
+ </ul>
+ </div>
+</div>
View
10 Website/Ebuy.Website.csproj
@@ -135,6 +135,8 @@
</Compile>
<Compile Include="App_Start\Routes.cs" />
<Compile Include="Areas\Admin\AdminAreaRegistration.cs" />
+ <Compile Include="Areas\Admin\Controllers\UsersController.cs" />
+ <Compile Include="Areas\Admin\Models\UserViewModel.cs" />
<Compile Include="Controllers\AccountController.cs" />
<Compile Include="Controllers\HomeController.cs" />
<Compile Include="Controllers\AuctionsController.cs" />
@@ -303,8 +305,6 @@
</ItemGroup>
<ItemGroup>
<Folder Include="App_Data\" />
- <Folder Include="Areas\Admin\Controllers\" />
- <Folder Include="Areas\Admin\Models\" />
<Folder Include="Areas\Admin\Views\Shared\" />
</ItemGroup>
<ItemGroup>
@@ -313,6 +313,12 @@
<ItemGroup>
<Content Include="Views\Auctions\Bids.cshtml" />
</ItemGroup>
+ <ItemGroup>
+ <Content Include="Areas\Admin\Views\Users\Users.cshtml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Content Include="Areas\Admin\Views\Users\User.cshtml" />
+ </ItemGroup>
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>

0 comments on commit b48a792

Please sign in to comment.
Something went wrong with that request. Please try again.