public async Task <ActionResult <TrinhDoDaoTao> > PostTrinhDoDaoTao(TrinhDoDaoTao trinhDoDaoTao) { _context.TrinhDoDaoTao.Add(trinhDoDaoTao); await _context.SaveChangesAsync(); return(CreatedAtAction("GetTrinhDoDaoTao", new { id = trinhDoDaoTao.IdtrinhDo }, trinhDoDaoTao)); }
public async Task <IActionResult> PutTrinhDoDaoTao(int id, TrinhDoDaoTao trinhDoDaoTao) { if (id != trinhDoDaoTao.IdtrinhDo) { return(BadRequest()); } _context.Entry(trinhDoDaoTao).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TrinhDoDaoTaoExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }