public async Task <IActionResult> PutBProductModel([FromRoute] int id, [FromBody] BProductModel bProductModel) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != bProductModel.Id) { return(BadRequest()); } _context.Entry(bProductModel).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BProductModelExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PostBProductModel([FromBody] BProductModel bProductModel) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.BProductModel.Add(bProductModel); await _context.SaveChangesAsync(); return(CreatedAtAction("GetBProductModel", new { id = bProductModel.Id }, bProductModel)); }