public async Task <ActionResult <TblTrinhDoHocVan> > PostTblTrinhDoHocVan(TblTrinhDoHocVan tblTrinhDoHocVan) { _context.TblTrinhDoHocVans.Add(tblTrinhDoHocVan); await _context.SaveChangesAsync(); return(CreatedAtAction("GetTblTrinhDoHocVan", new { id = tblTrinhDoHocVan.MaTdhv }, tblTrinhDoHocVan)); }
public async Task <IActionResult> PutTblTrinhDoHocVan(long id, TblTrinhDoHocVan tblTrinhDoHocVan) { if (id != tblTrinhDoHocVan.MaTdhv) { return(BadRequest()); } _context.Entry(tblTrinhDoHocVan).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TblTrinhDoHocVanExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }