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(); } }
public ActionResult Create(FriendlyUrl url) { try { using (var db = new FriendlyUrlEntities()) { db.FriendlyUrls.Add(url); db.SaveChanges(); } return RedirectToAction("Index"); } catch { return View(); } }