Yeah. It’s called Scaffolding.
The Visual Studio has Scaffolding shipped from version 2013, and per command line until version 2012 (maintained by Microsoft) and 2013 and 2015 (maintained by the community). This command line support can be installed via the following Nuget package:
https://www.nuget.org/packages/MVCScaffolding/ (for Visual Studio 2012)
https://www.nuget.org/packages/MVCScaffolding.VS2015/ (for Visual Studio 2013 and 2015)
https://www.nuget.org/packages/MvcScaffolding.VS2015/1.0.10 (only for Visual Studio 2015, if the latest version gives any error)
By command line, I teach how to use the commands in these responses:
Using the embedded feature of Visual Studio
I’m guessing you’re using Entity Framework and MVC5 in your project.
First you need to create a Model. I’ll put an example:
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
namespace MeuProjeto.Models
{
public class Color
{
[Key]
public int ColorId { get; set; }
[Required]
public String Name { get; set; }
[Required]
public String Code { get; set; }
public virtual ICollection<Product> Products { get; set; }
}
}
Then right click on the directory Controllers of your solution > Add > Controller...
Choose the option MVC 5 Controller with Views, using Entity Framework:
Fill the Model and the context class. If a context class does not yet exist, create one via the button +. Click on Add:
Once that’s done, one will be created Controller with the basic operations (List, Detail, Insert, Edit and Delete), more or less as shown in the image below:
Senbores, I would like to make a Formulary generator http://www.wufoo.com/ I don’t think I expressed myself well in my initial question.
– Jose Carlos