async and await in ASP.NET Core: The Explanation I Needed as a C# Developer

For a long time, I understood the basic rule: If a method uses await, it usually needs async. Example: public async Task<IActionResult> Index() { var accounts = await _context.Accounts.ToListAsync(); return…

Continue Readingasync and await in ASP.NET Core: The Explanation I Needed as a C# Developer

LINQ Finally Made Sense to Me When I Stopped Treating It Like Weird C# Syntax

LINQ is one of those C# features that can look strange when you first see it. Something like this: var transactions = await _context.Transactions .Where(t => t.Amount > 100) .OrderByDescending(t…

Continue ReadingLINQ Finally Made Sense to Me When I Stopped Treating It Like Weird C# Syntax

GET vs POST in ASP.NET Core MVC: What My Controller Is Actually Doing

I used to see controller code like this: [HttpGet] public IActionResult Create() { return View(); } [HttpPost] public IActionResult Create(CreateAccountViewModel model) { // save something } Both methods were named…

Continue ReadingGET vs POST in ASP.NET Core MVC: What My Controller Is Actually Doing