0
I have a table that returns the following data from an SQL Server database:
- INITIAL KM;
- KM Final;
- Liters;
- R-value$.
However I would like to return only the values ref. to the logged in user.
In the table in BD, I have a column that saves the user name (Note: I know that the name is not the best way, but the user ID, but at the moment we will work with names).
Controller
:
public class CombustivelController : Controller
{
private CombustiveisContext db = new CombustiveisContext();
// GET: Combustivel
public async Task<ActionResult> Index()
{
return View(await db.CombustivelModels.ToListAsync());
}
.
.
.
.
}
How could I do this consultation?
what is "logged in user"? It is the SQL Server user or the application has an internal user table?
– José Diz
@User Josédiz logged in via
Identity
, user logged in the page.– Thomas Erich Pimentel
Now the context is clear ("user logged in to the page"). It is that in the description there is only "logged in user" and the topic has the sql-server tag, which induced me to suggest the internal SQL Server functions that provide user/logon information.
– José Diz