public async Task <IActionResult> PostBMachinePropertyDetail([FromBody] BMachinePropertyDetail bMachinePropertyDetail) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.BMachinePropertyDetail.Add(bMachinePropertyDetail); await _context.SaveChangesAsync(); return(CreatedAtAction("GetBMachinePropertyDetail", new { id = bMachinePropertyDetail.Id }, bMachinePropertyDetail)); }
public async Task <IActionResult> PutBMachinePropertyDetail([FromRoute] int id, [FromBody] BMachinePropertyDetail bMachinePropertyDetail) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != bMachinePropertyDetail.Id) { return(BadRequest()); } _context.Entry(bMachinePropertyDetail).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BMachinePropertyDetailExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }