public IHttpActionResult PutSubPage(int id, SubPage subPage) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != subPage.SubPageId) { return(BadRequest()); } db.Entry(subPage).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!SubPageExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PostSubPage(SubPage subPage) { SubPageService subPageService = new SubPageService(); subPageService.UpsertSubPage(subPage, db); return(CreatedAtRoute("DefaultApi", new { id = subPage.SubPageId }, subPage)); }
/// <summary> /// Returns the default result of an action method for the controller used to perform a framework-level /// operation on behalf of the action method. /// <remarks>The resultant view will always match the name of the document type.</remarks> /// </summary> /// <param name="model">The model to provide the result for.</param> /// <returns> /// The <see cref="ActionResult"/>. /// </returns> public override ActionResult Index(RenderModel model) { SubPage page = model.As <SubPage>(); RenderSubPage viewModel = new RenderSubPage(page); return(this.View("SubPage", viewModel)); }
private void Navigation_BackRequested(object sender, BackRequestedEventArgs e) { SubPage.GoBack(); PageTitle.Text = SubPage.Content.GetType().GetTypeInfo().GetCustomAttribute <PageAttribute>().Title; if (!SubPage.CanGoBack) { Navigation.AppViewBackButtonVisibility = AppViewBackButtonVisibility.Collapsed; } }
private void Frame0_Navigated(object sender, System.Windows.Navigation.NavigationEventArgs e) { SubPage subPage = frame0.Content as SubPage; if (subPage != null) { TextBox textName = subPage.textName; } //remove the event handler frame0.Navigated -= Frame0_Navigated; }
public IHttpActionResult DeleteSubPage(int id) { SubPage subPage = db.SubPages.Find(id); if (subPage == null) { return(NotFound()); } db.SubPages.Remove(subPage); db.SaveChanges(); return(Ok(subPage)); }
public ServerMessage SerializeCatalogPages() { ServerMessage Message = new ServerMessage(Outgoing.OpenShop); Message.AppendBoolean(true); Message.AppendInt32(0); // icon Message.AppendInt32(-1); Message.AppendString("root"); Message.AppendString(""); Message.AppendInt32(0); Message.AppendInt32(GetTreeSize(-1)); foreach (CatalogPremiumPage Page in Pages.Values) { if (Page.ParentId != -1) { continue; } Page.Serialize(Message); Message.AppendInt32(GetTreeSize(Page.Id)); foreach (CatalogPremiumPage SubPage in Pages.Values) { if (SubPage.ParentId != Page.Id) { continue; } SubPage.Serialize(Message); Message.AppendInt32(GetTreeSize(SubPage.Id)); foreach (CatalogPremiumPage _SubPage in Pages.Values) { if (_SubPage.ParentId != SubPage.Id) { continue; } _SubPage.Serialize(Message); Message.AppendInt32(GetTreeSize(_SubPage.Id)); } } } Message.AppendBoolean(false); Message.AppendString("BUILDERS_CLUB"); return(Message); }
public void AndRegister_ShouldRegisterThePageAndItsBaseConcreteType() { // Arrange var container = Substitute.For <IObjectContainer>(); var sut = new SubPage(); PageProvider.SetContainer(container); // Act sut.AndRegisterPage(); // Assert container.Received(1).RegisterInstanceAs(sut, typeof(SubPage)); container.Received(1).RegisterInstanceAs(sut, typeof(DummyPage)); container.DidNotReceive().RegisterInstanceAs(sut, typeof(Page)); }
public SubPage UpsertSubPage(SubPage subPage, SubPageDBEntities db) { using (db) { if (subPage.SubPageId == default(int)) { db.SubPages.Add(subPage); } else { db.Entry(subPage).State = EntityState.Modified; } db.SaveChanges(); return(subPage); } }
private void NavigateSubPage(Type page, object parameter = null) { PageTitle.Text = page.GetTypeInfo().GetCustomAttribute <PageAttribute>().Title; if (page == typeof(MyPage)) { MyPageButton.Visibility = Visibility.Collapsed; Navigation.AppViewBackButtonVisibility = AppViewBackButtonVisibility.Collapsed; } else { MyPageButton.Visibility = Visibility.Visible; Navigation.AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible; } SubPage.Navigate(page, parameter); Menu.IsPaneOpen = false; }
public async Task <ActionResult> SubPage(SubPage page, int?id) { if (ModelState.IsValid) { var config = setting.GetSetting(); if (config == null) { setting.AddSetting(config); } switch (id) { default: config.Page1 = page; break; case 1: config.Page1 = page; break; case 2: config.Page2 = page; break; case 3: config.Page3 = page; break; } await setting.SaveAsync(); if (id >= 4) { return(RedirectToAction("Themes", "Admin")); } return(RedirectToAction("SubPage", "Admin", new { id = id + 1 })); } return(View(page)); }