public async Task <IActionResult> PutEvent(int id, Event events)
        {
            if (id != events.Id)
            {
                return(BadRequest());
            }

            _context.Entry(events).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!EventExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public async Task <IActionResult> PutFriendsList(int id, FriendsList friendsList)
        {
            if (id != friendsList.FriendsId)
            {
                return(BadRequest());
            }

            _context.Entry(friendsList).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!FriendsListExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public async Task <ActionResult <UserEvent> > PostUserEvent(UserEvent userEvent)
        {
            _context.UserEvents.Add(userEvent);

            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetUserEvent", new { id = userEvent.UserId }, userEvent));
        }
        public async Task <IActionResult> Create([Bind("Id,MaxParticipants,Day,StartTime,EndTime,Street,Neighborhood,City,SportId")] Event events)
        {
            var identidade = _userManager.GetUserId(User);

            if (!ModelState.IsValid)
            {
                events.OrganizerId       = identidade;
                events.waitEvent         = true;
                events.numbParticipants += 1;
                _context.Add(events);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["SportId"] = new SelectList(_context.SportGames, "Id", "SportName", events.SportId);
            return(View(events));
        }