Skip to content

Instantly share code, notes, and snippets.

@pjmagee
Created May 18, 2012 12:12
Show Gist options
  • Save pjmagee/2724971 to your computer and use it in GitHub Desktop.
Save pjmagee/2724971 to your computer and use it in GitHub Desktop.
public SearchViewModel()
{
Rooms = new List<RoomViewModel>(Enumerable.Range(1, 4).Select(rx =>
new RoomViewModel()
{
Id = rx,
Adults = new SelectList(Enumerable.Range(0, 5).Select(i =>
new SelectListItem
{
Selected = false,
Text = i.ToString(),
Value = i.ToString()
}), "Value", "Text", 0),
Children = new ChildenViewModel()
{
Children = new SelectList(Enumerable.Range(0, 4).Select(i =>
new SelectListItem()
{
Selected = false,
Text = i.ToString(),
Value = i.ToString()
}), "Value", "Text", 0),
ChildrenAges = new List<SelectList>(Enumerable.Range(1, 3).Select(i =>
new SelectList(Enumerable.Range(1, 17).Select(cx =>
new SelectListItem()
{
Selected = false,
Text = cx < 2 ? cx.ToString() + " or less" : cx.ToString(),
Value = cx.ToString()
}), "Value", "Text", 0))),
},
}));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment