public async Task<IHttpActionResult> PutResourceHistory(long id, ResourceHistory resourceHistory) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != resourceHistory.AuditId) { return BadRequest(); } db.Entry(resourceHistory).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ResourceHistoryExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }
// POST: odata/ResourceHistories public async Task<IHttpActionResult> Post(ResourceHistory resourceHistory) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.ResourceHistory.Add(resourceHistory); await db.SaveChangesAsync(); return Created(resourceHistory); }
public async Task<IHttpActionResult> PostResourceHistory(ResourceHistory resourceHistory) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.ResourceHistory.Add(resourceHistory); await db.SaveChangesAsync(); return CreatedAtRoute("DefaultApi", new { id = resourceHistory.AuditId }, resourceHistory); }