Created
June 4, 2010 18:59
-
-
Save jmarnold/425803 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
public class VendorsController : Controller | |
{ | |
private readonly IRepository _repository; | |
private readonly IMappingRegistry _mappingRegistry; | |
public VendorsController(IRepository repository, IMappingRegistry mappingRegistry) | |
{ | |
_repository = repository; | |
_mappingRegistry = mappingRegistry; | |
} | |
public ActionResult Details(int vendorId) | |
{ | |
var vendor = _repository.Get<Vendor>(vendorId); | |
if(vendor == null) | |
{ | |
return RedirectToAction("Search"); | |
} | |
var viewModel = _mappingRegistry.Map<Vendor, VendorDetailsModel>(vendor); | |
return View(viewModel); | |
} | |
public ActionResult Search() | |
{ | |
// some search implementation | |
return View(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment