示例#1
0
        // To protect from overposting attacks, please enable the specific properties you want to bind to, for
        // more details see https://aka.ms/RazorPagesCRUD.
        //Update the student.
        public IActionResult OnPost()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Attach(Student).State = EntityState.Modified;

            try
            {
                _context.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!StudentExists(Student.Id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(RedirectToPage("./Index"));
        }
示例#2
0
        // To protect from overposting attacks, please enable the specific properties you want to bind to, for
        // more details see https://aka.ms/RazorPagesCRUD.
        //Adds an exam.
        public IActionResult OnPost()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Exam.Add(Exam);
            _context.SaveChanges();

            return(RedirectToPage("./Index"));
        }
        //Remove the exam
        public IActionResult OnPost(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Exam = (from exam in _context.Exam
                    where exam.Id == id
                    select exam).FirstOrDefault();

            if (Exam != null)
            {
                _context.Exam.Remove(Exam);
                _context.SaveChanges();
            }

            return(RedirectToPage("./Index"));
        }
        //Removes the certification
        public IActionResult OnPost(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Certification = (from cert in _context.Certification
                             where cert.Id == id
                             select cert).FirstOrDefault();

            if (Certification != null)
            {
                _context.Certification.Remove(Certification);
                _context.SaveChanges();
            }

            return(RedirectToPage("./Index"));
        }
示例#5
0
        //Removes the student uses a linq query to select the student.
        public IActionResult OnPost(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Student = (from student in _context.Student
                       where student.Id == id
                       select student).FirstOrDefault();


            if (Student != null)
            {
                _context.Student.Remove(Student);
                _context.SaveChanges();
            }

            return(RedirectToPage("./Index"));
        }