public async Task <IActionResult> PutNCSystemFunctionalOption(string id, [FromBody] NCSystemFunctionalOptions nCSystemFunctionalOptions) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != nCSystemFunctionalOptions.TypeID) { return(BadRequest()); } db.Entry(nCSystemFunctionalOptions).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!NCSystemFunctionalOptionsExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode((int)HttpStatusCode.NoContent)); }
public async Task <IActionResult> PutSrvDriverTransformer(string id, [FromBody] SrvDriverTransformer srvDriverTransformer) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != srvDriverTransformer.TypeID) { return(BadRequest()); } db.Entry(srvDriverTransformer).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SrvDriverTransformerExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode((int)HttpStatusCode.NoContent)); }
public async Task <IHttpActionResult> PutPMSrvMotorSize(string id, PMSrvMotorSize pMSrvMotorSize) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != pMSrvMotorSize.TypeID) { return(BadRequest()); } db.Entry(pMSrvMotorSize).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PMSrvMotorSizeExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IActionResult> PutSpindleSrvMotorPara(string id, [FromBody] SpindleSrvMotorPara spindleSrvMotorPara) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != spindleSrvMotorPara.TypeID) { return(BadRequest()); } db.Entry(spindleSrvMotorPara).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SpindleSrvMotorParaExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode((int)HttpStatusCode.NoContent)); }
public async Task <IActionResult> PutRotaryTable(string id, [FromBody] RotaryTable rotaryTable) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != rotaryTable.TypeID) { return(BadRequest()); } db.Entry(rotaryTable).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!RotaryTableExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode((int)HttpStatusCode.NoContent)); }
public async Task <IHttpActionResult> PutFlexiblePinCoup(string id, FlexiblePinCoup flexiblePinCoup) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != flexiblePinCoup.TypeID) { return(BadRequest()); } db.Entry(flexiblePinCoup).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!FlexiblePinCoupExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IActionResult> PutDoubleRowCylinRollerBrg(string id, [FromBody] DoubleRowCylinRollerBrg doubleRowCylinRollerBrg) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != doubleRowCylinRollerBrg.TypeID) { return(BadRequest()); } db.Entry(doubleRowCylinRollerBrg).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DoubleRowCylinRollerBrgExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode((int)HttpStatusCode.NoContent)); }
public async Task <IActionResult> PutBWElasticSlvPinCoup(string id, [FromBody] BWElasticSlvPinCoup bWElasticSlvPinCoup) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != bWElasticSlvPinCoup.TypeID) { return(BadRequest()); } db.Entry(bWElasticSlvPinCoup).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BWElasticSlvPinCoupExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode((int)HttpStatusCode.NoContent)); }
public async Task<IHttpActionResult> PutAlignRollerBrg(string id, AlignRollerBrg alignRollerBrg) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != alignRollerBrg.TypeID) { return BadRequest(); } db.Entry(alignRollerBrg).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AlignRollerBrgExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }
public async Task <IHttpActionResult> PutNCSystemPowerUnit(string id, NCSystemPowerUnit nCSystemPowerUnit) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != nCSystemPowerUnit.TypeID) { return(BadRequest()); } db.Entry(nCSystemPowerUnit).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!NCSystemPowerUnitExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IActionResult> PutCommonCylinWormGear(string id, [FromBody] CommonCylinWormGear commonCylinWormGear) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != commonCylinWormGear.TypeID) { return(BadRequest()); } db.Entry(commonCylinWormGear).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CommonCylinWormGearExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode((int)HttpStatusCode.NoContent)); }
public async Task <IHttpActionResult> PutSpindleBeltLength(int id, SpindleBeltLength spindleBeltLength) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != spindleBeltLength.LengthID) { return(BadRequest()); } db.Entry(spindleBeltLength).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SpindleBeltLengthExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IHttpActionResult> PutElecSpindlePara(string id, ElecSpindlePara elecSpindlePara) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != elecSpindlePara.TypeID) { return(BadRequest()); } db.Entry(elecSpindlePara).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ElecSpindleParaExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IHttpActionResult> PutDeepGrooveBallBrg(string id, DeepGrooveBallBrg deepGrooveBallBrg) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != deepGrooveBallBrg.TypeID) { return(BadRequest()); } db.Entry(deepGrooveBallBrg).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DeepGrooveBallBrgExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IActionResult> PutSolidBallScrewNutPairs(string id, [FromBody] SolidBallScrewNutPairs solidBallScrewNutPairs) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != solidBallScrewNutPairs.TypeID) { return(BadRequest()); } db.Entry(solidBallScrewNutPairs).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SolidBallScrewNutPairsExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode((int)HttpStatusCode.NoContent)); }
public async Task <IHttpActionResult> PutHeliCylinGear(string id, HeliCylinGear heliCylinGear) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != heliCylinGear.TypeID) { return(BadRequest()); } db.Entry(heliCylinGear).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!HeliCylinGearExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
private async Task <IHttpActionResult> AddToDB(CNCMachineData db, string machineType, string mainType, string detailType, string url) { CNCMachineType cmt = new CNCMachineType() { MachineType = machineType, MainType = mainType, DetailType = detailType, ThumbNailUrl = url }; db.CNCMachineTypes.Add(cmt); await db.SaveChangesAsync(); int id = db.CNCMachineTypes.Local.Last().ID; return(CreatedAtRoute("DefaultApi", id, cmt)); }
private async Task AddToDB(CNCMachineData db, string name, string desc, string url) { CNCMachineType tt = new CNCMachineType() { MachineType = name, MainType = desc, ThumbNailUrl = url }; db.CNCMachineTypes.Add(tt); try { await db.SaveChangesAsync(); } catch (DbUpdateException) { } }