예제 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            NATTraversalModels nATTraversalModels = db.Articles.Find(id);

            db.Articles.Remove(nATTraversalModels);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #2
0
 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));
 }
예제 #3
0
        //[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));
        }
예제 #4
0
        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));
        }