public IHttpActionResult PutDigitalIds(int id, DigitalIds digitalIds) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != digitalIds.ID) { return BadRequest(); } db.Entry(digitalIds).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!DigitalIdsExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }
public IHttpActionResult PostDigitalIds(DigitalIds digitalIds) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.DigitalIds.Add(digitalIds); db.SaveChanges(); return CreatedAtRoute("DefaultApi", new { id = digitalIds.ID }, digitalIds); }