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(); }
public ActionResult LinkDelete(int id) { var link = new Link(); link = db.Links.Find(id); db.Links.Remove(link); db.SaveChanges(); return Content("ok"); }
public ActionResult LinkEdit(int id) { var link = new Link(); link = db.Links.Find(id); ViewBag.Link = link; return View(); }
public ActionResult AddLink(Link model) { if (ModelState.IsValid) { db.Links.Add(model); db.SaveChanges(); return Redirect("/Admin/Foundation/Link"); } else { ModelState.AddModelError("", "城市信息填写失败!"); } return View(); }