The values that are in the Teste2 action, move to Teste1 action with variable value, this is possible?
Possible, it is, but this is bad practice.
Note that the return of Teste1
and of Teste2
is a ActionResult
, that is, a complete result of an action executed in Controller. So it just wouldn’t be bad practice if the idea were something like:
public ActionResult Teste1(int num1, int num2)
{
return Teste2(1, 2); // veja este retorno.
}
public ActionResult Teste2(int num11, int num22)
{
//Alguns valores aqui...
var valor = 123;
return Content(valor); // veja aqui também.
}
If the idea is to repurpose logic, state Helpers (static classes with static methods inside), which are more efficient and the return is in variables that you define.
This is the most correct way or is there another way ?
– Matheus Miranda
The one demonstrated in the example of the answer is the most correct one, including, regarding inheritance, which can also be used in this way.
– Leonel Sanches da Silva