Skip to content

Instantly share code, notes, and snippets.

@jasonmccay
Created October 9, 2011 05:32
Show Gist options
  • Save jasonmccay/1273352 to your computer and use it in GitHub Desktop.
Save jasonmccay/1273352 to your computer and use it in GitHub Desktop.
Add Index method to the Controller
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