示例#1
0
 public ActionResult Delete(int id, FriendlyUrl link)
 {
     try
     {
         using (var db = new FriendlyUrlEntities())
         {
             db.Entry(link).State = EntityState.Deleted;
             db.SaveChanges();
             return RedirectToAction("Index");
         }
     }
     catch
     {
         return View();
     }
 }
示例#2
0
 public ActionResult Create(FriendlyUrl url)
 {
     try
     {
         using (var db = new FriendlyUrlEntities())
         {
             db.FriendlyUrls.Add(url);
             db.SaveChanges();
         }
         return RedirectToAction("Index");
     }
     catch
     {
         return View();
     }
 }