I have a table that returns the following data from a SQL Server database:
- Initial KM;
- Final KM;
- Liters;
- Value R $.
ButIwouldliketoonlyreturntherefvalues.totheloggedinuser.
InthetableintheDB,Ihaveacolumnthatsavestheusername(Note:Iknowthenameisnotthebest,buttheuserID,butatthemomentwearegoingtoworkwithnames.)
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 make this query?