Esempio n. 1
0
        public async Task <IActionResult> Create([Bind("RoomId,RoomName,IsUsed")] Room room)
        {
            if (ModelState.IsValid)
            {
                _context.Add(room);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(room));
        }
Esempio n. 2
0
        public async Task <IActionResult> Create([Bind("SubjectId,SubjectName,Description")] Subject subject)
        {
            if (ModelState.IsValid)
            {
                _context.Add(subject);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(subject));
        }
        public async Task <IActionResult> Create([Bind("UserId,FullName,Password,Role,Email")] User user)
        {
            if (ModelState.IsValid)
            {
                _context.Add(user);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(user));
        }
        public async Task <IActionResult> Create([Bind("CourseId,UserId")] Class @class)
        {
            if (ModelState.IsValid)
            {
                _context.Add(@class);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CourseId"] = new SelectList(_context.Course, "CourseId", "CourseId", @class.CourseId);
            ViewData["UserId"]   = new SelectList(_context.User, "UserId", "UserId", @class.UserId);
            return(View(@class));
        }
Esempio n. 5
0
        public async Task <IActionResult> Create([Bind("CourseId,UserId,SubjectId,RoomId,StartTime,EndTime")] Course course)
        {
            if (ModelState.IsValid)
            {
                _context.Add(course);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["RoomId"]    = new SelectList(_context.Room, "RoomId", "RoomId", course.RoomId);
            ViewData["SubjectId"] = new SelectList(_context.Subject, "SubjectId", "SubjectId", course.SubjectId);
            ViewData["UserId"]    = new SelectList(_context.User, "UserId", "UserId", course.UserId);
            return(View(course));
        }