4
I have a web application that I need to present a list containing some data, for that, I created the Model: Crm_Analise
:
public class Crm_Analise
{
[Key]
public int id { get; set; }
public string cod_item_CRM { get; set; }
public string TAG { get; set; }
public string data_creat { get; set; }
public string modelo { get; set; }
public int cliente_CRM { get; set; }
}
And for Scaffolding
created the Controller
and the Views
.
However, I need to show only the ref. data to the logged-in client.
So I’m using Session
to store client code.
Ai in the Controller
I did the following:
public async Task<ActionResult> Index()
{
if(Session["cod_cli"] != null)
{
db.Crm_Analise.Where(x => x.cliente_CRM == Convert.ToInt32(Session["cod_cli"]));
return View(await db.Crm_Analise.ToListAsync());
}
else
{
return Error();
}
}
But you haven’t changed at all, you keep bringing me the whole list.
Where is correct. Tried to see in the bank if all records are for the same user?
– Filipe Oliveira
@Filipeoliveira yes, I have checked and I have several records, for several different users..
– Thomas Erich Pimentel