public async Task <IActionResult> Create(StudentPromote studentPromote)
        {
            if (string.IsNullOrEmpty(HttpContext.Session.GetString("UserName")))
            {
                return(RedirectToAction("Login", "Home"));
            }
            if (ModelState.IsValid)
            {
                _context.Add(studentPromote);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ClassTblId"]        = new SelectList(_context.ClassTbls, "ClassTblId", "Name", studentPromote.ClassTblId);
            ViewData["ProgrameSessionId"] = new SelectList(_context.ProgrameSessions, "ProgrameSessionId", "Details", studentPromote.ProgrameSessionId);
            ViewData["SectionId"]         = new SelectList(_context.Sections, "SectionId", "Name", studentPromote.SectionId);
            ViewData["StudentId"]         = new SelectList(_context.Students, "StudentId", "Name", studentPromote.StudentId);
            return(View(studentPromote));
        }
        public async Task <IActionResult> Edit(int id, StudentPromote studentPromote)
        {
            if (string.IsNullOrEmpty(HttpContext.Session.GetString("UserName")))
            {
                return(RedirectToAction("Login", "Home"));
            }
            if (id != studentPromote.StudentPromoteId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(studentPromote);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!StudentPromoteExists(studentPromote.StudentPromoteId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ClassTblId"]        = new SelectList(_context.ClassTbls, "ClassTblId", "ClassTblId", studentPromote.ClassTblId);
            ViewData["ProgrameSessionId"] = new SelectList(_context.ProgrameSessions, "ProgrameSessionId", "ProgrameSessionId", studentPromote.ProgrameSessionId);
            ViewData["SectionId"]         = new SelectList(_context.Sections, "SectionId", "SectionId", studentPromote.SectionId);
            ViewData["StudentId"]         = new SelectList(_context.Students, "StudentId", "ContactNo", studentPromote.StudentId);
            return(View(studentPromote));
        }