public async Task <IActionResult> Edit(int id, [Bind("coursenameid,coursename,teacherid")] Coursename coursenames)
        {
            if (HttpContext.Session.GetString("FNAME") != null)
            {
                ViewBag.positionid = HttpContext.Session.GetString("POSITIONID");

                ViewBag.firstname  = HttpContext.Session.GetString("FNAME");
                ViewBag.positionid = HttpContext.Session.GetString("POSITIONID");
                ViewBag.teacherid  = HttpContext.Session.GetString("TEACHERID");
                ViewBag.adminid    = HttpContext.Session.GetString("ADMINID");
                ViewBag.studentid  = HttpContext.Session.GetString("STUDENTID");
                if (id != coursenames.coursenameid)
                {
                    return(NotFound());
                }

                if (ModelState.IsValid)
                {
                    try
                    {
                        _context.Update(coursenames);
                        await _context.SaveChangesAsync();
                    }
                    catch (DbUpdateConcurrencyException)
                    {
                        if (!CoursenameExists(coursenames.coursenameid))
                        {
                            return(NotFound());
                        }
                        else
                        {
                            throw;
                        }
                    }
                    return(RedirectToAction(nameof(Index)));
                }
                return(View(coursenames));
            }
            else
            {
                return(RedirectToAction("Index", "Signin"));
            }
        }
        public IActionResult Created(Coursename coursenames)
        {
            if (HttpContext.Session.GetString("FNAME") != null)
            {
                ViewBag.positionid = HttpContext.Session.GetString("POSITIONID");

                ViewBag.firstname  = HttpContext.Session.GetString("FNAME");
                ViewBag.positionid = HttpContext.Session.GetString("POSITIONID");
                ViewBag.teacherid  = HttpContext.Session.GetString("TEACHERID");
                ViewBag.adminid    = HttpContext.Session.GetString("ADMINID");
                ViewBag.studentid  = HttpContext.Session.GetString("STUDENTID");

                _context.Add(coursenames);
                _context.SaveChanges();


                return(RedirectToAction("Index"));
            }
            else
            {
                return(RedirectToAction("Index", "Signin"));
            }
        }