public async Task<IHttpActionResult> PutEventOwner(int id, EventOwner eventOwner) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != eventOwner.EventOwnerId) { return BadRequest(); } db.Entry(eventOwner).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EventOwnerExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }
public async Task<IHttpActionResult> PostEventOwner(EventOwner eventOwner) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.EventOwners.Add(eventOwner); await db.SaveChangesAsync(); return CreatedAtRoute("DefaultApi", new { id = eventOwner.EventOwnerId }, eventOwner); }