public async Task <IActionResult> PutDangkihoc(Dangkihoc dangkihoc) { //if (id != dangkihoc.Mahv) //{ // return BadRequest(); //} _context.Entry(dangkihoc).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { //if (!DangkihocExists(id)) //{ // return NotFound(); //} //else //{ // throw; //} } return(NoContent()); }
public async Task <ActionResult <Dangkihoc> > PostDangkihoc([FromBody] Dangkihoc dangkihoc) { _context.Dangkihoc.Add(dangkihoc); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (DangkihocExists(dangkihoc.Mahv)) { return(Conflict()); } else { throw; } } return(CreatedAtAction("GetDangkihoc", new { id = dangkihoc.Mahv }, dangkihoc)); }