Created
February 5, 2011 16:40
-
-
Save alastairs/812575 to your computer and use it in GitHub Desktop.
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
public ActionResult Record(int id) | |
{ | |
Record record = repository.Load(id); | |
var viewModel = new { record.Id, record.Name, record.Description, record.Url /* etc. */ }; | |
return View(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
public ActionResult Record(int id) | |
{ | |
Record record = repository.Load(id); | |
ViewModel viewModel = BuildViewModel(record); | |
return View(viewModel); | |
} | |
private ViewModel BuildViewModel(Record record) | |
{ | |
return new ViewModel { | |
record.Id, | |
record.Name, | |
record.Description, | |
record.Url | |
/* etc. */ | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment