public async Task <IActionResult> PutBMachineModel([FromRoute] int id, [FromBody] BMachineModel bMachineModel) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != bMachineModel.Id) { return(BadRequest()); } _context.Entry(bMachineModel).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BMachineModelExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PostBMachineModel([FromBody] BMachineModel bMachineModel) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.BMachineModel.Add(bMachineModel); await _context.SaveChangesAsync(); return(CreatedAtAction("GetBMachineModel", new { id = bMachineModel.Id }, bMachineModel)); }