Esempio n. 1
0
 public async Task<IActionResult> Create([Bind("Id,Name")] Classroom classroom)
 {
     if (ModelState.IsValid)
     {
         _context.Add(classroom);
         await _context.SaveChangesAsync();
         return RedirectToAction(nameof(Index));
     }
     return View(classroom);
 }
Esempio n. 2
0
        public async Task <IActionResult> Create([Bind("Id,Name,Description,CreatedAt,UpdateAt")] Subject subject)
        {
            if (ModelState.IsValid)
            {
                _context.Add(subject);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(subject));
        }
Esempio n. 3
0
        public async Task <IActionResult> Create([Bind("Id,Email,Password,ConfirmPassword,StudentInformation")] Account account)
        {
            if (ModelState.IsValid)
            {
                _context.Add(account);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ClassId"] = new SelectList(_context.Classroom, "Id", "Id", account.StudentInformation.ClassId);
            return(View(account));
        }
Esempio n. 4
0
        public async Task <IActionResult> Create([Bind("Id,Theory,Practice,Assignment,CreatedAt,UpdateAt")] Mark mark)
        {
            if (ModelState.IsValid)
            {
                _context.Add(mark);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["Id"] = new SelectList(_context.Set <Subject>(), "Id", "Id", mark.Id);
            return(View(mark));
        }
        public async Task <IActionResult> Create([Bind("AccountId,ClassId,FirstName,LastName,Phone,Address,BirthDay")] StudentInformation studentInformation)
        {
            if (ModelState.IsValid)
            {
                _context.Add(studentInformation);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["AccountId"] = new SelectList(_context.Account, "Id", "Id", studentInformation.AccountId);
            ViewData["ClassId"]   = new SelectList(_context.Classroom, "Id", "Id", studentInformation.ClassId);
            return(View(studentInformation));
        }