Exemplo n.º 1
0
        public async Task <IActionResult> Create([Bind("Id,Name,Address")] Campus campus)
        {
            if (ModelState.IsValid)
            {
                _context.Add(campus);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(campus));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Create([Bind("ID,Username,Password")] Models.Admin admin)
        {
            if (ModelState.IsValid)
            {
                _context.Add(admin);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(admin));
        }
Exemplo n.º 3
0
        public async Task <IActionResult> Create([Bind("Id,EclassId,Name,Gender,Nation,EnrollmentDate,PhoneNumber,Email,Password")] Models.Student student)
        {
            if (ModelState.IsValid)
            {
                _context.Add(student);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            ViewData["EClassID"] = new SelectList(_context.Eclass, "Id", "Id", student.EclassId);
            return(View(student));
        }
Exemplo n.º 4
0
        public async Task <IActionResult> Create([Bind("Id,DepartmentId,Title")] Course course)
        {
            SetViewData();
            if (ModelState.IsValid)
            {
                _context.Add(course);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            ViewData["DepartmentID"] = new SelectList(_context.Department, "Id", "Name", course.DepartmentId);
            return(View(course));
        }
Exemplo n.º 5
0
        public async Task <IActionResult> Create([Bind("Id,CampusId,InstructorId,Name,StartTime")] Department department)
        {
            if (ModelState.IsValid)
            {
                _context.Add(department);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            ViewData["InstructorID"] = new SelectList(_context.Instructor, "Id", "Name", department.InstructorId);
            ViewData["CampusID"]     = new SelectList(_context.Campus, "Id", "Name", department.CampusId);
            return(View(department));
        }
Exemplo n.º 6
0
        public async Task <IActionResult> Create([Bind("ID,InstructorID,MajorID,StartYear,Order")] Eclass eClass)
        {
            SetViewData();
            if (ModelState.IsValid)
            {
                _context.Add(eClass);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            ViewData["InstructorID"] = new SelectList(_context.Instructor, "Id", "Name", eClass.InstructorId);
            ViewData["MajorID"]      = new SelectList(_context.Major, "Id", "Title", eClass.MajorId);
            return(View(eClass));
        }