protected void AddMenuToHome( MvcContext ctx, String url, String name ) { IMenu menu = new SiteMenu(); menu.Name = name; menu.Url = "default"; // 设为首页 menu.RawUrl = UrlConverter.clearUrl( url, ctx, typeof( Site ).FullName, Site.Instance.Url ); User creator = ctx.viewer.obj as User; menuService.Insert( menu, creator, Site.Instance ); }
public int CompareTo(object obj) { SiteMenu menu = obj as SiteMenu; if (OrderId > menu.OrderId) { return(-1); } if (OrderId < menu.OrderId) { return(1); } if (base.Id > menu.Id) { return(1); } if (base.Id < menu.Id) { return(-1); } return(0); }
public IMenu AddMenuByApp( IMemberApp app, String name, String friendUrl, String rawAppUrl ) { Boolean isFirst = this.GetList(Site.Instance).Count == 0; IMenu menu = new SiteMenu(); menu.OwnerId = app.OwnerId; menu.OwnerUrl = app.OwnerUrl; menu.OwnerType = app.OwnerType; menu.Creator = app.Creator; menu.Name = name; menu.Url = friendUrl; if (isFirst) menu.Url = "default"; menu.RawUrl = rawAppUrl; menu.Created = DateTime.Now; Insert( menu ); updateRoute( menu ); return menu; }