Follow the code below:
Controller:
public ActionResult teste1(int num1, int num2)
{
// Aqui quero obter os valores da variável model1 e model2 da classe MyClass
var result = MyClass.Teste2(num1 , num2);
}
Model:
public class MyClass
{
public static Teste2(int num1, int num2)
{
var model1 = new AspNetUser();
var model2 = new AspNetUser1();
using (var ctx = new Entities())
{
model1 = ctx.Table.Where( x => ...).FirstOrDefault();
model2 = ctx.Table.Where( x => ...).FirstOrDefault();
}
//aqui: como retornar com "model1" e "model2" para ação "ActionResult" onde tem variável "result"?
}
}
How can I return with variables model1
and model2
to variable result
? Because AspNetUser
and AspNetUser
tbm are classes created with ADO.NET Entity Data Model. I already tried to ToArray
or ToList
and could not. I'm having a hard time returning.
Can anyone help me?