So when i scaffold a controller for my Event model it builds the typical GET/POST controller page.
It seems like every instance of the variable "event" has an @ in front of it. If i try to remove the @ it doesn't recognize the word as a variable (even with var in front of the word). Im pretty new to coding and i havent seen this before, what is causing this?
See examples below:
public async Task<IActionResult> Details(int? id)
{
if (id == null)
{
return NotFound();
}
var @event = await _context.Events
.FirstOrDefaultAsync(m => m.EventId == id);
if (@event == null)
{
return NotFound();
}
return View(@event);
}
public async Task<IActionResult> Create([Bind("EventId,Subject,Description,StartTime,EndTime,Theme,IsFullDay")] Event @event)
{
if (ModelState.IsValid)
{
_context.Add(@event);
await _context.SaveChangesAsync();
return RedirectToAction(nameof(Index));
}
return View(@event);
}