Example #1
0
 public ActionResult LinkEdit(Link model)
 {
     var link = db.Links.Find(model.ID);
     ViewBag.Link = link;
     if (ModelState.IsValid)
     {
         link.Title = model.Title;
         link.URL = model.URL;
         link.IsShow = model.IsShow;
         link.Priority = model.Priority;
         db.SaveChanges();
         return Redirect("/Admin/Foundation/Link");
     }
     else
     {
         ModelState.AddModelError("", "城市信息填写失败!");
     }
     return View();
 }
Example #2
0
 public ActionResult LinkDelete(int id)
 {
     var link = new Link();
     link = db.Links.Find(id);
     db.Links.Remove(link);
     db.SaveChanges();
     return Content("ok");
 }
Example #3
0
 public ActionResult LinkEdit(int id)
 {
     var link = new Link();
     link = db.Links.Find(id);
     ViewBag.Link = link;
     return View();
 }
Example #4
0
 public ActionResult AddLink(Link model)
 {
     if (ModelState.IsValid)
     {
         db.Links.Add(model);
         db.SaveChanges();
         return Redirect("/Admin/Foundation/Link");
     }
     else
     {
         ModelState.AddModelError("", "城市信息填写失败!");
     }
     return View();
 }