public ActionResult DeleteConfirmed(int id) { NATTraversalModels nATTraversalModels = db.Articles.Find(id); db.Articles.Remove(nATTraversalModels); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "ID,ServerName,ServiceAddress")] NATTraversalModels natTraversalModels) { if (ModelState.IsValid) { natTraversalModels.ServiceAddress = Regex.Replace(natTraversalModels.ServiceAddress, "localhost", GetIP()); db.Entry(natTraversalModels).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(natTraversalModels)); }
//[ValidateAntiForgeryToken] public ActionResult Create([Bind(Include = "ID,ServerName,ServiceAddress")] NATTraversalModels natTraversalModels) { if (ModelState.IsValid) { natTraversalModels.ServiceAddress = Regex.Replace(natTraversalModels.ServiceAddress, "localhost", GetIP()); db.Articles.Add(natTraversalModels); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(natTraversalModels)); }
public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } NATTraversalModels nATTraversalModels = db.Articles.Find(id); if (nATTraversalModels == null) { return(HttpNotFound()); } return(View(nATTraversalModels)); }