public async Task <IActionResult> Create([Bind("Name,Level,Instructor")] Course course)
        {
            if (ModelState.IsValid)
            {
                _context.Add(course);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(course));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Create([Bind("FirstName, LastName, Course")] Student student)
        {
            //boolean true or false
            if (ModelState.IsValid)
            {
                _context.Add(student);
                await _context.SaveChangesAsync();

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

            return(View(student));
        }