Thursday, August 15, 2013

MVC WITH ENTITY FRAME WORK

File->New->Project


select : ASP.NET MVC 4- Application
AND CLICK ON OK

And select the project template and click on ok



Now Go to Solution Explorer

And go to App Data



Add àExisting Item (and add any database)

I have added a database with name pubs.mdf


and go to solution explorer and u can see the database pubs.mdf  file is added



And again go to solution explorer and add new item
and add ado.net entity frame work



And click on add


Select  generate from database and click on Next


Click on next


Select your database and table (I have selected jobs table here) and click on finish
Now build the solution ( this is compulsory) before adding controller to the project
and now  add controller



And now  go to index.cs.html
And do the following changes


Id=item.job_id (here job id is the primary key)   do the following changes for edit, details, delete
And run the program and see the output
Output screen
Demo is the controller name



No comments:

Post a Comment

Thank you for visiting my blog

Kubernetes

Prerequisites We assume anyone who wants to understand Kubernetes should have an understating of how the Docker works, how the Docker images...