示例#1
0
        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);
        }
示例#2
0
 protected virtual ManagePageEditViewModel GetManagePageEditViewModel(Page page)
 {
     ManagePageEditViewModel model = new ManagePageEditViewModel
         {
             Page = page,
             SuperCategoryItems = GetSuperCategoryListItems(_dataContext.SuperCategories.ToList())
         };
     return model;
 }