public IHttpActionResult PutReferralSource(int id, ReferralSource referralSource) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != referralSource.ReferralSourceId) { return BadRequest(); } db.Entry(referralSource).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!ReferralSourceExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }
public IHttpActionResult PostReferralSource(ReferralSource referralSource) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.ReferralSources.Add(referralSource); db.SaveChanges(); return CreatedAtRoute("DefaultApi", new { id = referralSource.ReferralSourceId }, referralSource); }