public async Task <IActionResult> CreateBillOfMaterials([FromBody] Production.BillOfMaterials value) { _db.Production_BillOfMaterials.Add(value); await _db.SaveChangesAsync(); return(Ok(value)); }
public async Task <IActionResult> EditBillOfMaterials(int billOfMaterialsID, [FromBody] Production.BillOfMaterials value) { var existing = await _db.Production_BillOfMaterials.FirstOrDefaultAsync(x => x.BillOfMaterialsID == billOfMaterialsID); if (existing == null) { return(NotFound()); } existing.BillOfMaterialsID = value.BillOfMaterialsID; existing.ProductAssemblyID = value.ProductAssemblyID; existing.ComponentID = value.ComponentID; existing.StartDate = value.StartDate; existing.EndDate = value.EndDate; existing.UnitMeasureCode = value.UnitMeasureCode; existing.BOMLevel = value.BOMLevel; existing.PerAssemblyQty = value.PerAssemblyQty; existing.ModifiedDate = value.ModifiedDate; _db.Production_BillOfMaterials.Update(existing); await _db.SaveChangesAsync(); return(NoContent()); }