Exemple #1
0
        public async Task <IActionResult> Create([Bind("Id,DeptId,CourseId,StudentId,Status")] Enroll enroll)
        {
            if (ModelState.IsValid)
            {
                _context.Add(enroll);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(enroll));
        }
Exemple #2
0
        public async Task <IActionResult> Create([Bind("Id,DeptName,DeptCode")] Department department)
        {
            if (ModelState.IsValid)
            {
                _context.Add(department);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(department));
        }
        public async Task <IActionResult> Create([Bind("Id,RegNo,FullName,Mobile,Address,DeptId")] Student student)
        {
            if (ModelState.IsValid)
            {
                _context.Add(student);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["DeptId"] = new SelectList(_context.Department, "Id", "DeptCode", student.DeptId);
            return(View(student));
        }
Exemple #4
0
        public async Task <IActionResult> Create([Bind("Id,CourseName,CourseCode,DeptId")] Course course)
        {
            if (ModelState.IsValid)
            {
                _context.Add(course);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["DeptId"] = new SelectList(_context.Department, "Id", "DeptCode", course.DeptId);
            return(View(course));
        }