public async Task <IActionResult> PutQuanlidiem(Quanlidiem quanlidiem) { //if (id != quanlidiem.Mahv) //{ // return BadRequest(); //} _context.Entry(quanlidiem).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { //if (!QuanlidiemExists(id)) //{ // return NotFound(); //} //else //{ // throw; //} } return(NoContent()); }
public async Task <ActionResult <Quanlidiem> > PostQuanlidiem([FromBody] Quanlidiem quanlidiem) { _context.Quanlidiem.Add(quanlidiem); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (QuanlidiemExists(quanlidiem.Mahv)) { return(Conflict()); } else { throw; } } return(CreatedAtAction("GetQuanlidiem", new { id = quanlidiem.Mahv }, quanlidiem)); }