public IHttpActionResult PutPointsHistory(int id, PointsHistory pointsHistory) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != pointsHistory.id) { return(BadRequest()); } db.Entry(pointsHistory).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!PointsHistoryExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PostPointsHistory(PointsHistory pointsHistory) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.PointsHistories.Add(pointsHistory); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = pointsHistory.id }, pointsHistory)); }
public IHttpActionResult DeletePointsHistory(int id) { PointsHistory pointsHistory = db.PointsHistories.Find(id); if (pointsHistory == null) { return(NotFound()); } db.PointsHistories.Remove(pointsHistory); db.SaveChanges(); return(Ok(pointsHistory)); }