Пример #1
0
        public async Task <IActionResult> Create([Bind("StudentId,StudentNumber,FirstName,LastName,Email")] 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("TaskId,TaskName,DueDate,CompleteStatus,StudentNumber")] Task task)
        {
            if (ModelState.IsValid)
            {
                _context.Add(task);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["StudentNumber"] = new SelectList(_context.Student, "StudentNumber", "StudentNumber", task.StudentNumber);
            return(View(task));
        }