コード例 #1
0
        public async Task <IActionResult> Edit(string id, [Bind("StudentId,FirstName,LastName,Program")] Student student)
        {
            if (id != student.StudentId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(student);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!StudentExists(student.StudentId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(student));
        }
コード例 #2
0
        public async Task <IActionResult> Edit(string id, [Bind("TeacherId,FirstName,LastName,TeacherResume,School,Department")] Teacher teacher)
        {
            if (id != teacher.TeacherId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(teacher);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TeacherExists(teacher.TeacherId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(teacher));
        }
コード例 #3
0
        public async Task<IActionResult> Edit(string id, [Bind("CourseCode,StudentId,TeacherId,CourseTitle")] Course course)
        {
            if (id != course.CourseCode)
            {
                return NotFound();
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(course);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CourseExists(course.CourseCode))
                    {
                        return NotFound();
                    }
                    else
                    {
                        throw;
                    }
                }
                return RedirectToAction(nameof(Index));
            }
            ViewData["StudentId"] = new SelectList(_context.Student, "StudentId", "StudentId", course.StudentId);
            ViewData["TeacherId"] = new SelectList(_context.Teacher, "TeacherId", "TeacherId", course.TeacherId);
            return View(course);
        }
コード例 #4
0
        public async Task <IActionResult> Edit(string id, [Bind("RatingId,StudentId,Comment")] Rating rating)
        {
            if (id != rating.RatingId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(rating);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!RatingExists(rating.RatingId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["StudentId"] = new SelectList(_context.Student, "StudentId", "StudentId", rating.StudentId);
            return(View(rating));
        }
コード例 #5
0
        public async Task <IActionResult> Edit(string id, [Bind("AppoinmentId,StudentId,TeacherId,AppoinmentDate,AppoinmentTime,AppoinmentCoz")] Appoinment appoinment)
        {
            if (id != appoinment.AppoinmentId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(appoinment);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AppoinmentExists(appoinment.AppoinmentId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["StudentId"] = new SelectList(_context.Student, "StudentId", "StudentId", appoinment.StudentId);
            ViewData["TeacherId"] = new SelectList(_context.Teacher, "TeacherId", "TeacherId", appoinment.TeacherId);
            return(View(appoinment));
        }
コード例 #6
0
        public async Task <IActionResult> Edit(string id, [Bind("LoginName,Password")] Login login)
        {
            if (id != login.LoginName)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(login);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!LoginExists(login.LoginName))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["LoginName"] = new SelectList(_context.Student, "StudentId", "StudentId", login.LoginName);
            return(View(login));
        }