예제 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            PointsFrame pointsFrame = db.PointsFrames.Find(id);

            db.PointsFrames.Remove(pointsFrame);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #2
0
        public ActionResult Create([Bind(Include = "Id")] PointsFrame pointsFrame)
        {
            if (ModelState.IsValid)
            {
                db.PointsFrames.Add(pointsFrame);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(pointsFrame));
        }
예제 #3
0
        public ActionResult Edit([Bind(Include = "Id")] PointsFrame pointsFrame)
        {
            if (ModelState.IsValid)
            {
                db.Entry(pointsFrame).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(pointsFrame));
        }
예제 #4
0
        // POST: odata/PointsFrames
        public IHttpActionResult Post(PointsFrame pointsFrame)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.PointsFrames.Add(pointsFrame);
            db.SaveChanges();

            return(Created(pointsFrame));
        }
예제 #5
0
        // DELETE: odata/PointsFrames(5)
        public IHttpActionResult Delete([FromODataUri] int key)
        {
            PointsFrame pointsFrame = db.PointsFrames.Find(key);

            if (pointsFrame == null)
            {
                return(NotFound());
            }

            db.PointsFrames.Remove(pointsFrame);
            db.SaveChanges();

            return(StatusCode(HttpStatusCode.NoContent));
        }
예제 #6
0
        // GET: PointsFrames/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            PointsFrame pointsFrame = db.PointsFrames.Find(id);

            if (pointsFrame == null)
            {
                return(HttpNotFound());
            }

            return(View(pointsFrame));
        }
예제 #7
0
        public IHttpActionResult Patch([FromODataUri] int key, Delta <PointsFrame> patch)
        {
            Validate(patch.GetEntity());

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            PointsFrame pointsFrame = db.PointsFrames.Find(key);

            if (pointsFrame == null)
            {
                return(NotFound());
            }

            patch.Patch(pointsFrame);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!PointsFrameExists(key))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(Updated(pointsFrame));
        }