public async Task <IActionResult> PutBMachineType([FromRoute] int id, [FromBody] BMachineType bMachineType) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != bMachineType.TypeId) { return(BadRequest()); } _context.Entry(bMachineType).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BMachineTypeExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PostBMachineType([FromBody] BMachineType bMachineType) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.BMachineType.Add(bMachineType); await _context.SaveChangesAsync(); return(CreatedAtAction("GetBMachineType", new { id = bMachineType.TypeId }, bMachineType)); }