Tuesday 1 September 2015

Sample Project MVC 2

How  to create simple MVC 2 application with entity data model.

1.Create a Solution in vs 2010 show following image.




2.File ->new Project create solution->after creation solution ->right click on sol and add new project



3.Select ASP .NET MVC 2 Web Application show following.



4.   Select create a unit test project.                                                                                                                                                          
                                                                                                                                                         

5. After select unit test project show following view mvc project .                                                         


6.How to add SQL Server Database in App_Data show following .                                                          

7.  Select SQL Server Database.                                                                                                                                                             


8.  Change the database file name and save .mdf                                                                                       
                                                                        

9.Create a required database fields show following image.                                                                     


10.Save and enter table name show following image.                                                                               
                                                                       

11. Add another new table show following.                                                                                            

12.Add new table and enter the name of the table.                                                                                    

13.Add Home Controller .                                                                                                                          

14.How to add ADO .NET  Entity Data Model.                                                                                        

15.Select ADO .NET Entity Data Model.                                                                                                   
16.Open Entity Data Model Wizard,Select Generated From Database.                                                   

17.After select show following image.                                                                                                        
                                                                                         

18.After click next show following image.                                                                                               

19.Select the database tables.                                                                                                                   

20.Select the fields of tables.                                                                                                                   

21. After finish show following view.                                                                                                       

22.Right click Entity Data Model Design and select Add Code Generation Item......                                                                       


23. Select the Item show following.                                                                                                      

24.Go to Home controller and Add View.                                                                                                



25. Right click on create view.                                                                                                                   

26.Run the application show out put.                                                                                                       


27.After click 'Create New' then show following.                                                                                       

28. Enter the new records.                                                                                                                          

29. After 'create' new then "Run" show following.                                                                                     



No comments:

Post a Comment