Exemplo n.º 1
0
        public async Task <IActionResult> Create([Bind("RollNumber,FirstName,LastName,Email")] Student student)
        {
            if (ModelState.IsValid)
            {
                _context.Add(student);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(student));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Create([Bind("Id,SubjectName,SubjectMark,StudentRollNumber")] Mark mark)
        {
            if (ModelState.IsValid)
            {
                _context.Add(mark);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["StudentRollNumber"] = new SelectList(_context.Student, "RollNumber", "RollNumber", mark.StudentRollNumber);
            return(View(mark));
        }