public async Task <IActionResult> PutPhieucan(string id, Phieucan phieucan) { if (id != phieucan.Id) { return(BadRequest()); } _context.Entry(phieucan).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PhieucanExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <Phieucan> > PostPhieucan(Phieucan phieucan) { _context.Phieucan.Add(phieucan); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (PhieucanExists(phieucan.Id)) { return(Conflict()); } else { throw; } } return(CreatedAtAction("GetPhieucan", new { id = phieucan.Id }, phieucan)); }