Пример #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Sid,Name,Age,Phone")] Students students)
        {
            if (id != students.Sid)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(students);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!StudentsExists(students.Sid))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(students));
        }
Пример #2
0
        public async Task <IActionResult> Edit(string id, [Bind("CourseId,CourseName,Topic,Description,Year,Semester,PreRequisites,Compulsory")] Course course)
        {
            if (id != course.CourseId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(course);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CourseExists(course.CourseId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(course));
        }
Пример #3
0
        public async Task <IActionResult> Edit(int id, [Bind("EnrolId,CourseId,CourseDescription,EnrolmentYear,EnrolmentSemester,PreRequisite")] Enrolment enrolment)
        {
            if (id != enrolment.EnrolId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(enrolment);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!EnrolmentExists(enrolment.EnrolId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CourseId"] = new SelectList(_context.Course, "CourseId", "CourseId", enrolment.CourseId);
            return(View(enrolment));
        }