Пример #1
0
        public async Task <IActionResult> Create([Bind("NguoiDungId,Email,MatKau,XacNhanMatKhau,DiaChi,PhotoPath")] NguoiDung nguoiDung)
        {
            if (ModelState.IsValid)
            {
                _context.Add(nguoiDung);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(nguoiDung));
        }
Пример #2
0
        public async Task <IActionResult> Create([Bind("ThiId,TenThi,NguoiDungId")] Thi thi)
        {
            if (ModelState.IsValid)
            {
                _context.Add(thi);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["NguoiDungId"] = new SelectList(_context.NguoiDungs, "NguoiDungId", "DiaChi", thi.NguoiDungId);
            return(View(thi));
        }
Пример #3
0
        public async Task <IActionResult> Create([Bind("DapAnId,TenDapAn,TenCauHoi")] DapAn dapAn)
        {
            if (ModelState.IsValid)
            {
                _context.Add(dapAn);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CauHoiId"] = new SelectList(_context.CauHois, "CauHoiId", "TenCauHoi", dapAn.CauHoiId);
            return(View(dapAn));
        }
Пример #4
0
        public async Task <IActionResult> Create([Bind("CauHoiId,TenCauHoi,CauTraLoi1,CauTraLoi2,CauTraLoi3,CauTraLoi4,TheLoaiId")] CauHoi cauHoi)
        {
            if (ModelState.IsValid)
            {
                _context.Add(cauHoi);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["TheLoaiId"] = new SelectList(_context.TheLoais, "TheLoaiId", "TenTheLoai", cauHoi.TheLoaiId);
            return(View(cauHoi));
        }