When changing a Model, how to redo Scaffolding?

2

I have a model, called CombustivelModels , where I made a Scaffolding generating Controller and Views , my doubt is, when doing a revision in this Model , you can update via Scaffolding o Controller and View ?

Old model:

public class CombustivelModels
{
    [Key]
    public int CombustivelId { get; set; }

    [Required]
    public decimal km_inicial { get; set; }
    [Required]
    public decimal km_final { get; set; }
    [Required]
    public decimal litros { get; set; }
    [Required]
    [DataType(DataType.Currency)]
    public decimal valor { get; set; }
}

Model Revised:

public class CombustivelModels
    {
    [Key]
    public int CombustivelId { get; set; }

    [Required]
    public decimal km_inicial { get; set; }
    [Required]
    public decimal km_final { get; set; }
    [Required]
    public decimal litros { get; set; }
    [Required]
    [DataType(DataType.Currency)]
    public decimal valor { get; set; }

    [Required]
    public string UserId { get; set; }
}
    
asked by anonymous 30.11.2016 / 14:39

1 answer

2

You have to delete what has already been created and create it again.

The act of editing the model did not change what was already created.

Remembering that adding an annotation to the model changes how a @Html.EditFor<> mounts its textbox , for example.

Inclusion and deletion of new fields and relationships does not change the view.

Upgrading

I advise you to edit the view in your hand, once you understand how the view works, it's very easy to do, it's worth doing as a way of learning and studying.

    
30.11.2016 / 14:51