public async Task <IActionResult> Edit(int id, [Bind("MaMon,TenMon,SoTinChi")] MonHoc monHoc)
        {
            if (id != monHoc.MaMon)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(monHoc);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MonHocExists(monHoc.MaMon))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(monHoc));
        }
        public async Task <IActionResult> Edit(int id, [Bind("MaKhoa,TenKhoa")] Khoa khoa)
        {
            if (id != khoa.MaKhoa)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(khoa);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!KhoaExists(khoa.MaKhoa))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(khoa));
        }
Esempio n. 3
0
        public async Task <IActionResult> Edit(int id, [Bind("MaLHP,NamHoc,HocKy,MaMon,DiemGK,DiemCuoiKy")] LopHocPhan lopHocPhan)
        {
            if (id != lopHocPhan.MaLHP)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(lopHocPhan);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!LopHocPhanExists(lopHocPhan.MaLHP))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["MaMon"] = new SelectList(_context.MonHocs, "MaMon", "MaMon", lopHocPhan.MaMon);
            return(View(lopHocPhan));
        }
        public async Task <IActionResult> Edit(int id, [Bind("MaSV,HoTen,NgaySinh,DienThoai,MaKhoa")] SinhVien sinhVien)
        {
            if (id != sinhVien.MaSV)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(sinhVien);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SinhVienExists(sinhVien.MaSV))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["MaKhoa"] = new SelectList(_context.Khoas, "MaKhoa", "MaKhoa", sinhVien.MaKhoa);
            return(View(sinhVien));
        }