public ActionResult Create(FormCollection collection) { try { var model = new AdHocPageModel(); UpdateModel(model); var entity = new AdHocPage { Url = model.Url, User = UserIdentity.GetShortName(User), Test = true }; using (var repo = new AdHocPageRepository()) { repo.Add(entity); repo.SaveChanges(); } return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult Create(FormCollection collection) { try { var model = new AdHocPageModel(); UpdateModel(model); var entity = new AdHocPage { Url = model.Url, User = UserIdentity.GetShortName(User), Test = true }; using (var repo = new AdHocPageRepository()) { repo.Add(entity); repo.SaveChanges(); } return RedirectToAction("Index"); } catch { return View(); } }