public async Task <ActionResult <ViPhamGV> > PostViPhamGV(ViPhamGV viPhamGV) { _context.ViPhamGVs.Add(viPhamGV); await _context.SaveChangesAsync(); return(CreatedAtAction("GetViPhamGV", new { id = viPhamGV.Id }, viPhamGV)); }
public async Task <IActionResult> PutViPhamGV(int id, ViPhamGV viPhamGV) { if (id != viPhamGV.Id) { return(BadRequest()); } _context.Entry(viPhamGV).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ViPhamGVExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }