/// <summary> /// Create a new StaticPage object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="key">Initial value of the Key property.</param> /// <param name="title">Initial value of the Title property.</param> /// <param name="section">Initial value of the Section property.</param> /// <param name="isManual">Initial value of the IsManual property.</param> /// <param name="isSystem">Initial value of the IsSystem property.</param> /// <param name="accountId">Initial value of the AccountId property.</param> public static StaticPage CreateStaticPage(global::System.Int32 id, global::System.String key, global::System.String title, global::System.Int32 section, global::System.Boolean isManual, global::System.Boolean isSystem, global::System.Int32 accountId) { StaticPage staticPage = new StaticPage(); staticPage.Id = id; staticPage.Key = key; staticPage.Title = title; staticPage.Section = section; staticPage.IsManual = isManual; staticPage.IsSystem = isSystem; staticPage.AccountId = accountId; return staticPage; }
public ActionResult AddStaticPage(StaticContentItem item) { if (ModelState.IsValid) { using (new UnitOfWork(_currentContext)) { var staticPage = new StaticPage { Title = item.Title, Content = item.Content, Key = item.Key, IsManual = item.IsManual, IsSystem = item.IsSystem, Section = (int)item.Section, Account = accountRepository.GetByUsername(CurrentUserName) }; staticPagesRepository.Add(staticPage); } TempData[Const.ActionResultInfo] = "Страница успешно добавлена"; return Redirect(NavigationHelper.StaticPageActionUrl(item.Section)); } TempData[Const.ActionErrorInfo] = "Невозможно добавить страницу. Проверьте правильность введенных данных"; return View(); }
/// <summary> /// Deprecated Method for adding a new object to the StaticPageSet EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToStaticPageSet(StaticPage staticPage) { base.AddObject("StaticPageSet", staticPage); }