public async Task<IHttpActionResult> PutPollSampleEntity(int id, PollSampleEntity pollSampleEntity) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != pollSampleEntity.PollSampleEntityId) { return BadRequest(); } db.Entry(pollSampleEntity).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PollSampleEntityExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }
public async Task<IHttpActionResult> PostPollSampleEntity(PollSampleEntity pollSampleEntity) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.PollSamples.Add(pollSampleEntity); await db.SaveChangesAsync(); return CreatedAtRoute("DefaultApi", new { id = pollSampleEntity.PollSampleEntityId }, pollSampleEntity); }