Example #1
0
        public List <Menu> GetMenuItems()
        {
            var menus    = _menusService.GetAll();
            var menuInfo = _menuInfoService.GetAll();

            var model = (from m in menus
                         join mI in menuInfo on m.MenuID equals mI.MenuID
                         select new Menu
            {
                Id = m.MenuID,
                Name = mI.Menu,
                ParenetId = m.ParentID
            }
                         ).ToList();

            List <Menu> MenuItmes = new List <Menu>();

            for (int i = 0; i < model.Count; i++)
            {
                var item = new Menu {
                    Id = model[i].Id, Name = model[i].Name, ParenetId = model[i].ParenetId
                };
                MenuItmes.Add(item);
            }
            return(MenuItmes);
        }
Example #2
0
        public ActionResult Index(int?menuId = 0, int page = 1)
        {
            try
            {
                var menus    = _menusService.GetAll();
                var menuInfo = _menuInfoService.GetAll();

                var lists    = _listsService.GetAll();
                var listInfo = _listInfoService.GetAll();

                if (menuId > 0)
                {
                    ViewBag.MenuId = menuId;
                }
                else
                {
                    menuId = 0;
                }

                var model = (from m in menus
                             join mI in menuInfo on m.MenuID equals mI.MenuID
                             join l in lists on m.MenuListID equals l.ListID
                             join lI in listInfo on l.ListID equals lI.ListID
                             where m.ParentID == menuId
                             select new MenuListVM
                {
                    MenuID = m.MenuID,
                    MenuInfoID = mI.MenuInfoID,
                    Menu = mI.Menu,
                    MenuListID = m.MenuListID,
                    MenuYeri = lI.Value,
                    Active = m.Active,
                    CreationDate = m.CreationDate
                }
                             ).ToPagedList(page, (int)PagingEnums.Paging.PageSize);

                return(View(model));
            }
            catch (Exception ex)
            {
                TempData.Add("message", "Menü listeleme işleminde hata ile karşılaştı. Hata: " + ex.Message);
                return(View());
            }
        }
Example #3
0
        public string ListContentsMenu(string resource, IMenusService menusService, IMenuInfoService menuInfoService)
        {
            string strHtml  = "";
            int    parentID = 0;

            var menus    = menusService.GetAll();
            var menuInfo = menuInfoService.GetAll();

            var model = (from m in menus
                         join mI in menuInfo on m.MenuID equals mI.MenuID
                         where m.ParentID == parentID
                         select new MenuListVM
            {
                MenuID = m.MenuID,
                Menu = mI.Menu
            }
                         ).ToList();

            foreach (var item in model)
            {
                strHtml += "<li>";
                strHtml += string.Format(@"<input id= ""{0}"" type=""checkbox"" />< label for= ""vicepresident""> {1} </label>", item.MenuID, item.Menu);
                strHtml += "</li>";
            }



            //

            //<li>
            //    <input id="profil" type="checkbox" /><label for="vicepresident">Profil</label>
            //    <ul>
            //        <li><input id="hakkimizda" type="checkbox" /><label for="manager4">Hakkımızda</label></li>
            //        <li><input id="degerlerimiz" type="checkbox" /><label for="manager5">Değerlerimiz</label></li>
            //    </ul>
            //</li>



            return(strHtml);
        }