Exemplo n.º 1
0
        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));
        }
Exemplo n.º 2
0
        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));
        }
Exemplo n.º 3
0
        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));
        }