Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
devinrader
committed
Dec 22, 2011
1 parent
3fe14bf
commit b48a792
Showing
5 changed files
with
89 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -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); | |||
} | |||
|
|||
} | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -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 | |||
{ | |||
} | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,5 @@ | |||
@{ | |||
ViewBag.Title = "User"; | |||
} | |||
|
|||
<h2>User</h2> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters