public async Task <IActionResult> Edit(int id, [Bind("FooterItem_id,Link,Name")] FooterMenu footerMenu) { if (id != footerMenu.FooterItem_id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(footerMenu); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!FooterMenuExists(footerMenu.FooterItem_id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(footerMenu)); }
private void bindFooterMenus(List <FooterMenu> menus) { StringBuilder builder = new StringBuilder(); for (int i = 0; i < menus.Count; i++) { if (i > 0) { builder.Append(" | "); } FooterMenu menu = menus[i] as FooterMenu; builder.Append("<a href=\""); if (PathHelper.IsFullUrl(menu.Link)) { builder.Append(menu.Link); } else { builder.Append(strUtil.Join(sys.Path.Root, menu.Link)); } builder.Append("\">"); builder.Append(menu.Name); builder.Append("</a>"); } set("footerMenus", builder); }
public async Task <IActionResult> Edit(int id, [Bind("FooterItem_id,Link,Name")] FooterMenu footerMenu) { throw new NotImplementedException(); //if (id != footerMenu.FooterItem_id) //{ // return NotFound(); //} //if (ModelState.IsValid) //{ // try // { // _context.Update(footerMenu); // await _context.SaveChangesAsync(); // } // catch (DbUpdateConcurrencyException) // { // if (!FooterMenuExists(footerMenu.FooterItem_id)) // { // return NotFound(); // } // else // { // throw; // } // } // return RedirectToAction(nameof(Index)); //} //return View(footerMenu); }
public override void Layout() { load("topNav", new TopNavController().IndexNew); load("header", new TopNavController().Header); set("statsJs", config.Instance.Site.GetStatsJs()); set("adFooter", AdItem.GetAdById(AdCategory.Footer)); set("adLoadLink", to(new AdLoaderController().Index)); bindCommon(); bindSiteSkin(); set("siteBeiAn", config.Instance.Site.BeiAn); set("copyright", lang("siteCopyright")); set("ramsize", lang("memoryUse") + ": " + (((Environment.WorkingSet / 1024) / 1024)) + " MB"); List <FooterMenu> menus = FooterMenu.GetAll(); bindFooterMenus(menus); set("customSkinLink", to(new Admin.SiteSkinController().CustomBg)); }
public async Task <IActionResult> PutFooterMenu(int id, FooterMenu footerMenu) { if (id != footerMenu.Id) { return(BadRequest()); } _context.Entry(footerMenu).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!FooterMenuExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <FooterMenu> > PostFooterMenu(FooterMenu footerMenu) { _context.FooterMenus.Add(footerMenu); await _context.SaveChangesAsync(); return(CreatedAtAction("GetFooterMenu", new { id = footerMenu.Id }, footerMenu)); }
public virtual void SaveSort() { int id = ctx.PostInt("id"); String cmd = ctx.Post("cmd"); FooterMenu data = cdb.findById <FooterMenu>(id); String condition = (ctx.app == null ? "" : "AppId=" + ctx.app.Id); List <FooterMenu> list = FooterMenu.GetAll(); if (cmd == "up") { new SortUtil <FooterMenu>(data, list).MoveUp(); echoJsonOk(); } else if (cmd == "down") { new SortUtil <FooterMenu>(data, list).MoveDown(); echoJsonOk(); } else { echoError(lang("exUnknowCmd")); } }
private void createPage(String title, PageCategory category, Boolean isFooter) { Page page = new Page(); page.Creator = new User(1); page.OwnerType = typeof(Site).FullName; page.OwnerUrl = "/"; page.Title = title; page.Content = title; page.Category = category; page.EditReason = "创建页面"; pageService.Insert(page); // FooterMenu if (isFooter == false) { return; } FooterMenu fm = new FooterMenu(); fm.Name = page.Name; fm.Link = to(new Common.PageController().Show, page.Id); fm.insert(); }
private void bindLink(IBlock tpl, String lbl, object obj) { FooterMenu data = obj as FooterMenu; tpl.Set("data.Link", lnkFull(data.Link)); tpl.Set("data.LinkEdit", to(Edit, data.Id)); tpl.Set("data.LinkDelete", to(Delete, data.Id)); }
public void List() { List <FooterMenu> menus = FooterMenu.GetAll(); bindList("list", "data", menus, bindLink); set("addLink", to(Add)); set("sortAction", to(SaveSort)); }
public static void AddFooterMenuItem(FooterMenu footerMenuControl, ValueDataField menuItem, int index, ICommand command, double fontSize, bool isWfDesignMode) { var button = CreateCustomButton(menuItem, command, fontSize, isWfDesignMode); FooterMenu.SetRow(button, GetRow(menuItem, index)); FooterMenu.SetColumn(button, GetColumn(menuItem, index)); footerMenuControl.Menu.Add(button); }
public async Task <IActionResult> Create([Bind("FooterItem_id,Link,Name")] FooterMenu footerMenu) { throw new NotImplementedException(); //if (ModelState.IsValid) //{ // _context.Add(footerMenu); // await _context.SaveChangesAsync(); // return RedirectToAction(nameof(Index)); //} //return View(footerMenu); }
public async Task <IActionResult> Create([Bind("FooterItem_id,Link,Name")] FooterMenu footerMenu) { if (ModelState.IsValid) { _context.Add(footerMenu); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(footerMenu)); }
public void Edit(int id) { target(Update, id); FooterMenu data = FooterMenu.GetById(id); if (data == null) { echoRedirect(lang("exDataNotFound")); return; } bind("data", data); }
private FooterMenu validate(FooterMenu data) { data = ctx.PostValue(data) as FooterMenu; if (strUtil.IsNullOrEmpty(data.Name)) { errors.Add(lang("exName")); } if (strUtil.IsNullOrEmpty(data.Link)) { errors.Add(lang("exLink")); } return(data); }
public void Create() { FooterMenu data = validate(new FooterMenu()); if (ctx.HasErrors) { run(Add); return; } data.insert(); log(SiteLogString.AddFooterMenu(), data); echoToParentPart(lang("opok")); }
public void Delete(int id) { FooterMenu data = FooterMenu.GetById(id); if (data == null) { echoRedirect(lang("exDataNotFound")); return; } data.delete(); log(SiteLogString.DeleteFooterMenu(), data); echoAjaxOk(); }
public ActionResult FooterLink(long id) { try { FooterMenu page = _ContentServices.GetContentOfItem <FooterMenu>(ContentServices.ServiceTables.FooterMenu, 1, id).Contents.FirstOrDefault(); ViewBag.page = page; return(View("FooterPage")); } catch (Exception ex) { return(RedirectToAction("Index", "Oops")); } }
public override void Layout() { // load( "topNav", new TopNavController().Index ); load("header", new TopNavController().Header); set("statsJs", config.Instance.Site.GetStatsJs()); set("adFooter", AdItem.GetAdById(AdCategory.Footer)); set("adLoadLink", to(new AdLoaderController().Index)); bindCommon(); bindSiteSkin(); set("copyright", lang("siteCopyright")); set("ramsize", lang("memoryUse") + ": " + (((Environment.WorkingSet / 1024) / 1024)) + " MB"); List <FooterMenu> menus = FooterMenu.GetAll(); bindFooterMenus(menus); if (ctx.viewer.IsLogin) { User user = (User)ctx.viewer.obj; //User owner = ctx.owner.obj as User; set("RegLink", Link.T2(user, new UserProfileController().Profile)); set("labUserName", user.Name); set("LoginLink", Link.T2(Site.Instance, new MainController().Logout)); set("logStatus", "×¢Ïú"); } else { set("RegLink", Link.T2(Site.Instance, new RegisterController().Register)); set("labUserName", "×¢²á"); set("LoginLink", Link.T2(Site.Instance, new MainController().Login)); set("logStatus", "µÇ¼"); } set("customSkinLink", to(new Admin.SiteSkinController().CustomBg)); }
public void Update(int id) { FooterMenu data = FooterMenu.GetById(id); if (data == null) { echoRedirect(lang("exDataNotFound")); return; } data = validate(data); if (ctx.HasErrors) { run(Edit, id); return; } data.update(); log(SiteLogString.UpdateFooterMenu(), data); echoToParentPart(lang("opok")); }
public static void CreateFooterMenu(FooterMenu footerMenuControl, ValueDataField field, ICommand command, double fontSize, bool isWfDesignMode) { if (footerMenuControl == null) { footerMenuControl = new FooterMenu(); } footerMenuControl.Visibility = field.Visible ? Visibility.Visible : Visibility.Collapsed; ValueDataField[] menu; if (DataField.TryGetFieldProperties(field, ValueDataFieldConstants.FooterMenu, isWfDesignMode, out menu)) { var index = 0; foreach (var menuItem in menu.Where(p => p != null).OrderBy(p => p.Order)) { AddFooterMenuItem(footerMenuControl, menuItem, index++, command, fontSize, isWfDesignMode); } } if (fontSize > 0) { footerMenuControl.FontSize = fontSize; } string focusNavigationDirection; if (DataField.TryGetFieldProperties(field, ValueDataFieldConstants.NavigationDirectionOnGotFocus, isWfDesignMode, out focusNavigationDirection)) { footerMenuControl.NavigationDirectionOnGotFocus = (FocusNavigationDirection)Enum.Parse(typeof(FocusNavigationDirection), focusNavigationDirection); } if (field.SetFocus) { footerMenuControl.BackgroundFocus(); } }
private void log(String msg, FooterMenu data) { String dataInfo = "{Id:" + data.Id + ", Name:'" + data.Name + "'}"; logService.Add((User)ctx.viewer.obj, msg, dataInfo, typeof(FooterMenu).FullName, ctx.Ip); }