public IHttpActionResult PutProcess(int id, Process process) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != process.Id) { return BadRequest(); } db.Entry(process).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!ProcessExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }
public IHttpActionResult PostProcess(Process process) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.Processes.Add(process); db.SaveChanges(); return CreatedAtRoute("DefaultApi", new { id = process.Id }, process); }