コード例 #1
0
        public IActionResult RegisterMB(Student s)
        {
            // This verifies all data annotations in the class are valid
            if (ModelState.IsValid)
            {
                // Add to database
                StudentDb.Register(s);

                // Display success message
                ViewData["Success"] = "Student was succesfully registered!";
                return(View());
            }
            return(View());
        }