コード例 #1
0
 public void UpdateModel(Models.CustomPage customPage, Person currentPerson)
 {
     customPage.CustomPageDisplayName         = CustomPageDisplayName;
     customPage.CustomPageVanityUrl           = CustomPageVanityUrl;
     customPage.CustomPageDisplayTypeID       = CustomPageDisplayTypeID.Value;
     customPage.CustomPageNavigationSectionID = CustomPageNavigationSectionID;
 }
コード例 #2
0
 public EditViewModel(Models.CustomPage customPage)
 {
     CustomPageID                  = customPage.CustomPageID;
     CustomPageDisplayName         = customPage.CustomPageDisplayName;
     CustomPageVanityUrl           = customPage.CustomPageVanityUrl;
     CustomPageDisplayTypeID       = customPage.CustomPageDisplayTypeID;
     CustomPageNavigationSectionID = customPage.CustomPageNavigationSectionID;
 }
コード例 #3
0
        public ActionResult Index(int pageId, FormCollection form)
        {
            ViewData["PageId"] = pageId;
            Page p = db.Set<Page>().Find(pageId);
            CustomPage customPage = repo.Retrieve(x => x.PageId == pageId, null, null).SingleOrDefault();
            if (customPage != null)
            {
                //update
                TryUpdateModel(customPage);
                if (ModelState.IsValid)
                {
                    repo.Update(customPage);
                }
            }
            else
            {
                //insert
                CustomPage cp = new Models.CustomPage();
                cp.Page = p;
                cp.Controller = form["Controller"].ToString();
                cp.Action = form["Action"].ToString();

                if (ModelState.IsValid)
                {
                    repo.Add(cp);
                }
            }

            if (ModelState.IsValid)
            {
                try
                {
                    repo.Save();
                    return RedirectToAction("Index", "Page");
                }
                catch (Exception ex)
                {
                    ModelState.AddModelError("", ex.Message);
                    Error.Exception(ex, "/CustomPage/Index");
                }
            }

            return View(customPage);
        }
コード例 #4
0
 public void UpdateModel(Models.CustomPage customPage)
 {
     customPage.CustomPageContentHtmlString = CustomPageContentHtmlString == null || string.IsNullOrWhiteSpace(CustomPageContentHtmlString.ToString()) ? null : CustomPageContentHtmlString;
 }
コード例 #5
0
 public EditHtmlContentInDialogViewModel(Models.CustomPage customPage)
 {
     CustomPageContentHtmlString = customPage != null ? customPage.CustomPageContentHtmlString : null;
 }