public async Task <IActionResult> Edit(short id, [Bind("Id,CStage,SCode")] ClaSub claSub)
        {
            if (id != claSub.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(claSub);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ClaSubExists(claSub.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            ViewData["CStage"] = new SelectList(_context.Class, "CStage", "CStage", claSub.CStage);
            ViewData["SCode"]  = new SelectList(_context.Subject, "SCode", "SName", claSub.SCode);
            return(View(claSub));
        }
        public async Task <IActionResult> Edit(short id, [Bind("Id,Name,Password,Class")] Student student)
        {
            if (id != student.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(student);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!StudentExists(student.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            ViewData["Class"] = new SelectList(_context.Class, "CStage", "CStage", student.Class);
            return(View(student));
        }
        public async Task <IActionResult> Edit(short id, [Bind("Serial,SCode,CStage,RoomNo,Date,Time")] ExamRoutine examRoutine)
        {
            if (id != examRoutine.Serial)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(examRoutine);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ExamRoutineExists(examRoutine.Serial))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            ViewData["CStage"] = new SelectList(_context.Class, "CStage", "CStage", examRoutine.CStage);
            ViewData["RoomNo"] = new SelectList(_context.Room, "RoomNo", "RoomNo", examRoutine.RoomNo);
            ViewData["SCode"]  = new SelectList(_context.Subject, "SCode", "SName", examRoutine.SCode);
            return(View(examRoutine));
        }
        public async Task <IActionResult> Edit(short id, [Bind("Id,Name,Password,Department")] Teacher teacher)
        {
            if (id != teacher.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(teacher);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TeacherExists(teacher.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            return(View(teacher));
        }
コード例 #5
0
        public async Task <IActionResult> Edit(string id, [Bind("CStage,CType")] Class @class)
        {
            if (id != @class.CStage)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(@class);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ClassExists(@class.CStage))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            return(View(@class));
        }
コード例 #6
0
        public async Task <IActionResult> Edit(short id, [Bind("RoomNo,Type")] Room room)
        {
            if (id != room.RoomNo)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(room);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!RoomExists(room.RoomNo))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            return(View(room));
        }
        public async Task <IActionResult> Edit(short id, [Bind("Id,Name,Password,Email")] Registry registry)
        {
            if (id != registry.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(registry);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!RegistryExists(registry.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            return(View(registry));
        }
        public async Task <IActionResult> Edit(short id, [Bind("SCode,SName,SType,TId")] Subject subject)
        {
            if (id != subject.SCode)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(subject);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SubjectExists(subject.SCode))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            ViewData["TId"] = new SelectList(_context.Teacher, "Id", "Name", subject.TId);
            return(View(subject));
        }