public IHttpActionResult PostJikokuhyou(Jikokuhyou jikokuhyou) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.Jikokuhyou.Add(jikokuhyou); db.SaveChanges(); return CreatedAtRoute("DefaultApi", new { id = jikokuhyou.JikokuhyouId }, jikokuhyou); }
public IHttpActionResult PutJikokuhyou(int id, Jikokuhyou jikokuhyou) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != jikokuhyou.JikokuhyouId) { return BadRequest(); } db.Entry(jikokuhyou).State = System.Data.Entity.EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!JikokuhyouExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }