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