コード例 #1
0
        public async Task <IActionResult> Create([Bind("GradeId,GradeName,Section")] Grade grade)
        {
            if (ModelState.IsValid)
            {
                _context.Add(grade);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(grade));
        }
コード例 #2
0
        public async Task <IActionResult> Create([Bind("StudentId,StudentName")] Student student)
        {
            if (ModelState.IsValid)
            {
                _context.Add(student);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(student));
        }