예제 #1
0
        public async Task <IActionResult> Create([Bind("RollNumber,FirstName,LastName,Phone,Email,Avatar,CreatedAt,UpdatedAt,Status")] Student student)
        {
            if (ModelState.IsValid)
            {
                _context.Add(student);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(student));
        }
예제 #2
0
        public async Task <IActionResult> Create([Bind("Id,SubjectId,StudentRollNumber,SubjectMark,TeacherId,CreatedAt,UpdatedAt")] 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);
            ViewData["SubjectId"]         = new SelectList(_context.Subject, "Id", "Id", mark.SubjectId);
            ViewData["TeacherId"]         = new SelectList(_context.Teacher, "Id", "Id", mark.TeacherId);
            return(View(mark));
        }