Esempio n. 1
0
        public async Task <IActionResult> Create([Bind("StudentId,SchoolClassId")] SchoolClassStudent schoolClassStudent)
        {
            if (ModelState.IsValid)
            {
                _context.Add(schoolClassStudent);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["SchoolClassId"] = new SelectList(_context.SchoolClasses, "Id", "ClassName", schoolClassStudent.SchoolClassId);
            return(View(schoolClassStudent));
        }
        public async Task <IActionResult> Create([Bind("Id,ClassName,TeacherId,Created")] SchoolClass schoolClass)
        {
            if (ModelState.IsValid)
            {
                schoolClass.Id = Guid.NewGuid();
                _context.Add(schoolClass);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(schoolClass));
        }