// PUT api/Record/5 public IHttpActionResult Put(int id, CheckListRecord checklistrecord) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != checklistrecord.Id) { return BadRequest(); } _db.Entry(checklistrecord).State = EntityState.Modified; try { _db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!CheckListRecordExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }
public IHttpActionResult Post(CheckListRecord checklistrecord) { if (!ModelState.IsValid) { return BadRequest(ModelState); } _db.Records.Add(checklistrecord); _db.SaveChanges(); return CreatedAtRoute("DefaultApi", new { id = checklistrecord.Id }, checklistrecord); }