public IHttpActionResult PutStatus(int id, Status status) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != status.Id) { return BadRequest(); } db.Entry(status).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!StatusExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }
public IHttpActionResult PostStatus(Status status) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.Status.Add(status); db.SaveChanges(); //return Ok(status); return CreatedAtRoute("DefaultApi", new { id = status.Id }, status); }