Home:ALL Converter>How do I populate my model from a database entry?

How do I populate my model from a database entry?

Ask Time:2014-10-30T22:39:48         Author:Tevis

Json Formatter

I have set up a large form with lots of entries. It populates my model and then saves to the database. I also need to be able to pull this information out of the database, put it into the model, and populate a bunch of fields with it for review. How do I do this?

Using ASP.NET MVC 4 Razor.

var db = new TechProjPlansContext();

TechProjPlan model = new TechProjPlan();

I can set up my data context and model, but where do I go from here to populate the model with a data entry chosen by ID?

Author:Tevis,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/26655908/how-do-i-populate-my-model-from-a-database-entry
asdf_enel_hak :

You can search by givenId and if found return result type of TechProjPlan otherwise null\n\nvar resultFound = db.TechProjPlans.Where(e=>e.Id = givenId).FirstOrDefault();\n",
2014-10-30T14:42:07
yy