public ActionResult UrlEdit(IdentityDB.Model.CustomModel.Url u) { if (ModelState.IsValid) { _db2.Update(u); return(RedirectToAction("UrlIndex")); } return(View(u)); }
public ActionResult UrlCreate(IdentityDB.Model.CustomModel.Url u) { if (ModelState.IsValid) { //u.UserID = User.Identity.GetUserId(); // 当前用户ID _db2.Insert(u); return(RedirectToAction("UrlIndex")); } return(View(u)); }
// // GET: /Admin/Edit/5 public ActionResult UrlEdit(string key = "") { if (key.Length > 0) { IdentityDB.Model.CustomModel.Url u = _db2.Urls.Find(m => m.UrlKey == key); if (u != null) { return(View(u)); } } return(HttpNotFound()); }
// // GET: /Admin/Delete/5 public ActionResult UrlDelete(string key = "") { if (key.Length > 0) { IdentityDB.Model.CustomModel.Url u = _db2.Urls.Find(m => m.UrlKey == key); if (u != null) { //_db.Urls.Remove(u); //_db.SaveChanges(); _db2.Delete(u); return(RedirectToAction("UrlIndex")); } } return(HttpNotFound()); }