Пример #1
0
 /// <summary>
 /// Create a new StaticSubPage 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="staticPageId">Initial value of the StaticPageId property.</param>
 /// <param name="accountId">Initial value of the AccountId property.</param>
 public static StaticSubPage CreateStaticSubPage(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 staticPageId, global::System.Int32 accountId)
 {
     StaticSubPage staticSubPage = new StaticSubPage();
     staticSubPage.Id = id;
     staticSubPage.Key = key;
     staticSubPage.Title = title;
     staticSubPage.Section = section;
     staticSubPage.IsManual = isManual;
     staticSubPage.IsSystem = isSystem;
     staticSubPage.StaticPageId = staticPageId;
     staticSubPage.AccountId = accountId;
     return staticSubPage;
 }
Пример #2
0
        public ActionResult AddSubPage(SubPageViewModel viewModel)
        {
            if (ModelState.IsValid)
            {
                using (new UnitOfWork(_currentContext))
                {
                    var subPage = new StaticSubPage()
                        {
                            Title = viewModel.Title,
                            Content = viewModel.Content,
                            Account = accountRepository.GetByUsername(CurrentUserName),
                            IsManual = viewModel.IsManual,
                            IsSystem = viewModel.IsSystem,
                            Key = viewModel.Key,
                            StaticPageId = viewModel.StaticPageId,
                            Section = (int)viewModel.Section
                        };

                    var page = staticPagesRepository.GetById(viewModel.StaticPageId);
                    page.SubPages.Add(subPage);

                    TempData[Const.ActionResultInfo] = "Страница успешно добавлена";
                    return RedirectToAction("ManageStaticPage", new { id = viewModel.StaticPageId });
                }
            }

            TempData[Const.ActionErrorInfo] = "Ошибка добавления страницы. Проверьте правильность введенных данных";
            return RedirectToAction("ManageStaticPage", new { id = viewModel.StaticPageId });
        }
Пример #3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the StaticSubPageSet EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToStaticSubPageSet(StaticSubPage staticSubPage)
 {
     base.AddObject("StaticSubPageSet", staticSubPage);
 }