public async Task <IActionResult> Edit(Guid id, [Bind("DtEntrada,EventoId,UsuarioId,Id")] Agendar agendar)
        {
            if (id != agendar.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(agendar);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AgendarExists(agendar.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["EventoId"]  = new SelectList(_context.Eventos, "Id", "Descricao", agendar.EventoId);
            ViewData["UsuarioId"] = new SelectList(_context.Users, "Id", "Id", agendar.UsuarioId);
            return(View(agendar));
        }
        public async Task <IActionResult> Create(Guid EventoId)
        {
            Agendar agendar = new Agendar();

            if (ModelState.IsValid)
            {
                var     IdUsu   = _userManager.GetUserId(HttpContext.User);
                Usuario usuario = _userManager.FindByIdAsync(IdUsu).Result;
                agendar.Id        = Guid.NewGuid();
                agendar.DtEntrada = DateTime.Now;
                agendar.EventoId  = EventoId;
                agendar.UsuarioId = usuario.Id;
                _context.Add(agendar);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["EventoId"]  = new SelectList(_context.Eventos, "Id", "Descricao", agendar.EventoId);
            ViewData["UsuarioId"] = new SelectList(_context.Users, "Id", "Id", agendar.UsuarioId);
            return(View(agendar));
        }