public IHttpActionResult PostIndicationInfo(IndicationInfo indicationInfo) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.IndicationInfo.Add(indicationInfo); try { db.SaveChanges(); } catch (DbUpdateException) { if (IndicationInfoExists(indicationInfo.Id)) { return Conflict(); } else { throw; } } return CreatedAtRoute("DefaultApi", new { id = indicationInfo.Id }, indicationInfo); }
public IHttpActionResult PutIndicationInfo(int id, IndicationInfo indicationInfo) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != indicationInfo.Id) { return BadRequest(); } db.Entry(indicationInfo).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!IndicationInfoExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }