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)); }
public ActionResult DeleteConfirmed(int id) { Ooredo ooredo = db.Ooredoes.Find(id); db.Ooredoes.Remove(ooredo); db.SaveChanges(); return(RedirectToAction("Index")); }
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)); }
public IHttpActionResult GetOoredo(int id) { Ooredo ooredo = db.Ooredoes.Find(id); if (ooredo == null) { return(NotFound()); } return(Ok(ooredo)); }
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)); }
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)); }
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)); }
// 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)); }