public async Task <IActionResult> Edit(string id, [Bind("CtdgMa,CtdgNgaydg,SodanhgiaSdgMa,HocsinhHsMa")] Chitietdanhgia chitietdanhgia) { if (id != chitietdanhgia.CtdgMa) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(chitietdanhgia); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ChitietdanhgiaExists(chitietdanhgia.CtdgMa)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["HocsinhHsMa"] = new SelectList(_context.Hocsinh, "HsMa", "HsMa", chitietdanhgia.HocsinhHsMa); ViewData["SodanhgiaSdgMa"] = new SelectList(_context.Sodanhgia, "SdgMa", "SdgMa", chitietdanhgia.SodanhgiaSdgMa); return(View(chitietdanhgia)); }
public async Task <IActionResult> Create([Bind("CtdgMa,CtdgNgaydg,SodanhgiaSdgMa,HocsinhHsMa")] Chitietdanhgia chitietdanhgia) { if (ModelState.IsValid) { _context.Add(chitietdanhgia); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["HocsinhHsMa"] = new SelectList(_context.Hocsinh, "HsMa", "HsMa", chitietdanhgia.HocsinhHsMa); ViewData["SodanhgiaSdgMa"] = new SelectList(_context.Sodanhgia, "SdgMa", "SdgMa", chitietdanhgia.SodanhgiaSdgMa); return(View(chitietdanhgia)); }