// GET: Events/Edit/5 public async Task <IActionResult> Edit(int?id) { if (id == null) { return(NotFound()); } // Somente edita quem e o dono do evento var identidade = _userManager.GetUserId(User); if (!_baseContext.EventOrg(identidade, (int)id)) { return(RedirectToAction(nameof(Index))); } var @event = await _context.Events.FindAsync(id); if (@event == null) { return(NotFound()); } ViewData["SportId"] = new SelectList(_context.SportGames, "Id", "SportName", @event.SportId); return(View(@event)); }