Hakan Axheim

Hakan Axheim

  • NA
  • 201
  • 33k

Sending a parameter from a Controller to a FormModel

Apr 8 2020 8:32 AM
Hi, 
 
I have a question regarding how to send a parameter from a Controller to a FormModel.
 
The parameter I have to send to the FormModel is created in the entity model.
This variable is a boolean that holds a value of true or false.
 
In my controller, I have an ActionResult method Edit that calls a method in the FormModel class.
 
How can I pass a parameter from the Controller method Edit to the FormModel.

As you see I am not that good at ASP.NET
 
 
This is an extract of my Edit method in Controller class:
- public ActionResult Edit(PrimaryCodeFormModel model)

var canEditCode = model.CanEditCode();
if (canEditCode)
{
       return base.Edit(model);
}

When return base.Edit(model) will be called  I end up in my FormModel which is called PrimaryCodeFormModel.cs
But how to send a parameter from the Controller to the Model?

Answers (1)