Esempio n. 1
0
        public async Task <IActionResult> Edit(int id, [Bind("Pkexam,ExDate,Subject")] Exams exams)
        {
            if (id != exams.Pkexam)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(exams);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ExamsExists(exams.Pkexam))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(exams));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Ppkfkstudent,Ppkfkexam,Grade")] StudentsExams studentsExams)
        {
            if (id != studentsExams.Ppkfkstudent)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(studentsExams);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!StudentsExamsExists(studentsExams.Ppkfkstudent))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["Ppkfkexam"]    = new SelectList(_context.Exams, "Pkexam", "Subject", studentsExams.Ppkfkexam);
            ViewData["Ppkfkstudent"] = new SelectList(_context.Students, "Pkstudent", "Name", studentsExams.Ppkfkstudent);
            return(View(studentsExams));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Pkstudent,Name")] Students students)
        {
            if (id != students.Pkstudent)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(students);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!StudentsExists(students.Pkstudent))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(students));
        }