public IHttpActionResult PutInjuryDictionary(int id, InjuryDictionary injuryDictionary) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != injuryDictionary.Id) { return BadRequest(); } _ctx.Entry(injuryDictionary).State = EntityState.Modified; try { _ctx.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!InjuryDictionaryExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }
public IHttpActionResult PostInjuryDictionary(InjuryDictionary injuryDictionary) { if (!ModelState.IsValid) { return BadRequest(ModelState); } _ctx.InjuryDictionaries.Add(injuryDictionary); _ctx.SaveChanges(); return CreatedAtRoute("DefaultApi", new { id = injuryDictionary.Id }, injuryDictionary); }