I was able to create a .NetCore 2.1 website with Enitity Framework by following a Microsoft tutorial.
The web app connects to a MS SQL Database and uses scaffolding to translate the database tables into classes.
But all it is doing behind the scenes is basic queries like 'select * from myTable' etc.
For example, I have this simple controller that just gets all the Players in the PlayerList table:
// GET: PlayerLists
public async Task<IActionResult> Index()
{
return View(await _context.PlayerList.ToListAsync());
}
This one is a little more complicated, but it's really just getting one Player:
// GET: PlayerLists/Edit/5
public async Task<IActionResult> Edit(int? id)
{
if (id == null)
{
return NotFound();
}
var playerList = await _context.PlayerList.FindAsync(id);
if (playerList == null)
{
return NotFound();
}
return View(playerList);
}
This works, but I need something more complex to get a very specific set of data from my database.
How can I add a query that runs a very specific query with SQL Joins, case statements, and group by clauses?
Thanks!