public async Task <IActionResult> PutBMatSubstitute([FromRoute] int id, [FromBody] BMatSubstitute bMatSubstitute) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != bMatSubstitute.Id) { return(BadRequest()); } _context.Entry(bMatSubstitute).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BMatSubstituteExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PostBMatSubstitute([FromBody] BMatSubstitute bMatSubstitute) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.BMatSubstitute.Add(bMatSubstitute); await _context.SaveChangesAsync(); return(CreatedAtAction("GetBMatSubstitute", new { id = bMatSubstitute.Id }, bMatSubstitute)); }