MVC4 Mobile Classic
Step 3 of 4: Add a Controller

Next, add a Controller for TahDoList.

  1. In the Solution Explorer, right-click the Controllers folder and select Add | Controller. The Add Controller dialog box opens.
  2. Enter a Controller name, for example, TodoController.
  3. Under Template in the Scaffolding options box, select MVC controller with read/write actions and views, using Entity Framework.  
  4. Under Model class, select TahDoList (ToDo.Models), which is the strongly typed class you want a model for. The Model class you select should be your Model name with YourApplicationName.Models in the parentheses.
  5. Under Data context class, enter a data context class with the following format:

    YourApplicationName.Models.YourApplicationNameContext


     

  6. Click Add.Visual Studio generates everything you need, including controllers and views for all of the CRUD operations against our model. Links to the Entity Framework for data access have also been automatically created.

Now run the project to dynamically create a database and add new items.

See Also

 

 


Copyright (c) GrapeCity, inc. All rights reserved.

Product Support Forum |  Documentation Feedback