Created
October 9, 2011 05:32
-
-
Save jasonmccay/1273352 to your computer and use it in GitHub Desktop.
Add Index method to the Controller
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 Index() | |
{ | |
var model = new DeveloperModel(); | |
var developers_collection = mongo_db.GetCollection("developers").FindAll().AsEnumerable(); | |
model.developers = (from developer in developers_collection | |
select new DeveloperDTO | |
{ | |
id = developer["_id"].AsObjectId, | |
name = developer["name"].AsString, | |
languages = developer["languages"].AsBsonArray.ToString(), | |
company = developer["company"].AsString | |
}).ToList(); | |
return View(model); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment