public async Task <IActionResult> Edit(string id, [Bind("ThMa,ThTen")] Tiethoc tiethoc) { if (id != tiethoc.ThMa) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(tiethoc); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TiethocExists(tiethoc.ThMa)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(tiethoc)); }
public async Task <IActionResult> Create([Bind("ThMa,ThTen")] Tiethoc tiethoc) { if (ModelState.IsValid) { _context.Add(tiethoc); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(tiethoc)); }