public IHttpActionResult PutReferralContact(int id, ReferralContact referralContact) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != referralContact.ReferralContactId) { return BadRequest(); } db.Entry(referralContact).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!ReferralContactExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }
public IHttpActionResult PostReferralContact(ReferralContact referralContact) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.ReferralContacts.Add(referralContact); db.SaveChanges(); return CreatedAtRoute("DefaultApi", new { id = referralContact.ReferralContactId }, referralContact); }