// PUT api/WorkerData/5 public IHttpActionResult PutWorkerData(int id, WorkerData workerdata) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != workerdata.ID) { return BadRequest(); } db.Entry(workerdata).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!WorkerDataExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }
public IHttpActionResult PostWorkerData(WorkerData workerdata) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.WorkerDatas.Add(workerdata); db.SaveChanges(); return CreatedAtRoute("DefaultApi", new { id = workerdata.ID }, workerdata); }