public async Task <IActionResult> PutBMaterialType([FromRoute] int id, [FromBody] BMaterialType bMaterialType) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != bMaterialType.TypeId) { return(BadRequest()); } _context.Entry(bMaterialType).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BMaterialTypeExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PostBMaterialType([FromBody] BMaterialType bMaterialType) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.BMaterialType.Add(bMaterialType); await _context.SaveChangesAsync(); return(CreatedAtAction("GetBMaterialType", new { id = bMaterialType.TypeId }, bMaterialType)); }