Exemplo n.º 1
0
        public async Task <IActionResult> Create([Bind("Sid,Name,Age,Phone")] Students students)
        {
            if (ModelState.IsValid)
            {
                _context.Add(students);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(students));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Create([Bind("CourseId,CourseName,Topic,Description,Year,Semester,PreRequisites,Compulsory")] Course course)
        {
            if (ModelState.IsValid)
            {
                _context.Add(course);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(course));
        }
Exemplo n.º 3
0
        public async Task <IActionResult> Create([Bind("EnrolId,CourseId,CourseDescription,EnrolmentYear,EnrolmentSemester,PreRequisite")] Enrolment enrolment)
        {
            if (ModelState.IsValid)
            {
                _context.Add(enrolment);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CourseId"] = new SelectList(_context.Course, "CourseId", "CourseId", enrolment.CourseId);
            return(View(enrolment));
        }