public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } try { await repo.SaveEventAsync(Event); } catch (DbUpdateConcurrencyException) { Models.Event x = await repo.GetEventAsync(Event.Id); if (x == null) { return(NotFound()); } else { throw; } } return(RedirectToPage("EventIndex", new { teamId = Event?.TeamId })); }