public async Task <IActionResult> Create([Bind("EventTblId,EventTitle,EventDate,Location,Description,UserId")] EventTbl eventTbl)
        {
            if (string.IsNullOrEmpty(HttpContext.Session.GetString("UserName")))
            {
                return(RedirectToAction("Login", "Home"));
            }
            int userid = Convert.ToInt32(HttpContext.Session.GetString("UserId"));

            eventTbl.UserId = userid;
            if (ModelState.IsValid)
            {
                _context.Add(eventTbl);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["UserId"] = new SelectList(_context.Users, "UserId", "UserId", eventTbl.UserId);
            return(View(eventTbl));
        }
        public async Task <IActionResult> Edit(int id, EventTbl eventTbl)
        {
            if (string.IsNullOrEmpty(HttpContext.Session.GetString("UserName")))
            {
                return(RedirectToAction("Login", "Home"));
            }
            int userid = Convert.ToInt32(HttpContext.Session.GetString("UserId"));

            eventTbl.UserId = userid;
            if (id != eventTbl.EventTblId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(eventTbl);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!EventTblExists(eventTbl.EventTblId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["UserId"] = new SelectList(_context.Users, "UserId", "UserId", eventTbl.UserId);
            return(View(eventTbl));
        }