コード例 #1
0
        public IHttpActionResult PostvwRegistry(vwRegistry vwRegistry)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.vwRegistries.Add(vwRegistry);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (vwRegistryExists(vwRegistry.id))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = vwRegistry.id }, vwRegistry));
        }
コード例 #2
0
        public IHttpActionResult PutvwRegistry(Guid id, vwRegistry vwRegistry)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != vwRegistry.id)
            {
                return(BadRequest());
            }

            db.Entry(vwRegistry).State = EntityState.Modified;

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #3
0
        public ActionResult DeleteConfirmed(Guid id)
        {
            vwRegistry vwRegistry = db.vwRegistries.Find(id);

            db.vwRegistries.Remove(vwRegistry);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #4
0
 public ActionResult Edit([Bind(Include = "id,registry,entry")] vwRegistry vwRegistry)
 {
     if (ModelState.IsValid)
     {
         db.Entry(vwRegistry).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(vwRegistry));
 }
コード例 #5
0
        public IHttpActionResult GetvwRegistry(Guid id)
        {
            vwRegistry vwRegistry = db.vwRegistries.Find(id);

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

            return(Ok(vwRegistry));
        }
コード例 #6
0
        public ActionResult Create([Bind(Include = "id,registry,entry")] vwRegistry vwRegistry)
        {
            if (ModelState.IsValid)
            {
                vwRegistry.id = Guid.NewGuid();
                db.vwRegistries.Add(vwRegistry);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(vwRegistry));
        }
コード例 #7
0
        // GET: vwRegistries/Delete/5
        public ActionResult Delete(Guid?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            vwRegistry vwRegistry = db.vwRegistries.Find(id);

            if (vwRegistry == null)
            {
                return(HttpNotFound());
            }
            return(View(vwRegistry));
        }
コード例 #8
0
        public IHttpActionResult DeletevwRegistry(Guid id)
        {
            vwRegistry vwRegistry = db.vwRegistries.Find(id);

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

            db.vwRegistries.Remove(vwRegistry);
            db.SaveChanges();

            return(Ok(vwRegistry));
        }