Exemple #1
0
        public IHttpActionResult PutOoredo(int id, Ooredo ooredo)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Exemple #2
0
        public ActionResult DeleteConfirmed(int id)
        {
            Ooredo ooredo = db.Ooredoes.Find(id);

            db.Ooredoes.Remove(ooredo);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemple #3
0
 public ActionResult Edit([Bind(Include = "Id,x,y,address,title")] Ooredo ooredo)
 {
     if (ModelState.IsValid)
     {
         db.Entry(ooredo).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(ooredo));
 }
Exemple #4
0
        public IHttpActionResult GetOoredo(int id)
        {
            Ooredo ooredo = db.Ooredoes.Find(id);

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

            return(Ok(ooredo));
        }
Exemple #5
0
        public ActionResult Create([Bind(Include = "Id,x,y,address,title")] Ooredo ooredo)
        {
            if (ModelState.IsValid)
            {
                db.Ooredoes.Add(ooredo);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(ooredo));
        }
Exemple #6
0
        public IHttpActionResult PostOoredo(Ooredo ooredo)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.Ooredoes.Add(ooredo);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = ooredo.Id }, ooredo));
        }
Exemple #7
0
        public IHttpActionResult DeleteOoredo(int id)
        {
            Ooredo ooredo = db.Ooredoes.Find(id);

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

            db.Ooredoes.Remove(ooredo);
            db.SaveChanges();

            return(Ok(ooredo));
        }
Exemple #8
0
        // GET: OoredoesMvc/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Ooredo ooredo = db.Ooredoes.Find(id);

            if (ooredo == null)
            {
                return(HttpNotFound());
            }
            return(View(ooredo));
        }