public async Task <IActionResult> PutBNgCode([FromRoute] int id, [FromBody] BNgCode bNgCode) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != bNgCode.NgId) { return(BadRequest()); } _context.Entry(bNgCode).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BNgCodeExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PostBNgCode([FromBody] BNgCode bNgCode) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.BNgCode.Add(bNgCode); await _context.SaveChangesAsync(); return(CreatedAtAction("GetBNgCode", new { id = bNgCode.NgId }, bNgCode)); }