public ActionResult Create(ManagePageEditViewModel model) { if (ModelState.IsValid) { model.Page.UrlFriendlyName = Regex.Replace(model.Page.Name, @"[^\w]+", "-", RegexOptions.IgnoreCase); _dataContext.Pages.Add(model.Page); _dataContext.SaveChanges(); return RedirectToAction("Detail", new { model.Page.Id }); } return View(model); }
protected virtual ManagePageEditViewModel GetManagePageEditViewModel(Page page) { ManagePageEditViewModel model = new ManagePageEditViewModel { Page = page, SuperCategoryItems = GetSuperCategoryListItems(_dataContext.SuperCategories.ToList()) }; return model; }