public async Task <ActionResult <ViPhamSV> > PostViPhamSV(ViPhamSV viPhamSV) { _context.ViPhamSVs.Add(viPhamSV); await _context.SaveChangesAsync(); return(CreatedAtAction("GetViPhamSV", new { id = viPhamSV.Id }, viPhamSV)); }
public async Task <IActionResult> PutViPhamSV(int id, ViPhamSV viPhamSV) { if (id != viPhamSV.Id) { return(BadRequest()); } _context.Entry(viPhamSV).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ViPhamSVExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }