public async Task<IActionResult> Create( Club club ) { if( ModelState.IsValid ) { var user = await GetCurrentUserAsync(); club.ApplicationUser = user; _context.Club.Add( club ); _context.SaveChanges(); // Assign the club to have the logged in user as it's manager user.Club = club; var result = await _userManager.UpdateAsync( user ); return RedirectToAction( "Index" ); } return View( club ); }
public IActionResult Edit( Club club ) { if( ModelState.IsValid ) { _context.Update( club ); _context.SaveChanges(); return RedirectToAction( "Index" ); } return View( club ); }