public async Task <IActionResult> Edit(short id, [Bind("Serial,CStage,SCode,RoomNo,Day,Time")] ClassRoutine classRoutine)
        {
            if (id != classRoutine.Serial)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(classRoutine);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ClassRoutineExists(classRoutine.Serial))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            ViewData["CStage"] = new SelectList(_context.Class, "CStage", "CStage", classRoutine.CStage);
            ViewData["RoomNo"] = new SelectList(_context.Room, "RoomNo", "RoomNo", classRoutine.RoomNo);
            ViewData["SCode"]  = new SelectList(_context.Subject, "SCode", "SName", classRoutine.SCode);
            return(View(classRoutine));
        }
        public async Task <IActionResult> Create([Bind("Serial,CStage,SCode,RoomNo,Day,Time")] ClassRoutine classRoutine)
        {
            if (ModelState.IsValid)
            {
                _context.Add(classRoutine);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            ViewData["CStage"] = new SelectList(_context.Class, "CStage", "CStage", classRoutine.CStage);
            ViewData["RoomNo"] = new SelectList(_context.Room, "RoomNo", "RoomNo", classRoutine.RoomNo);
            ViewData["SCode"]  = new SelectList(_context.Subject, "SCode", "SName", classRoutine.SCode);
            return(View(classRoutine));
        }