public IActionResult Index() { MenuListViewModel model = new MenuListViewModel(); model.Menu = _menuService.GetAll(); return(View(model)); }
public async Task <IActionResult> Index( string currentSortOrder, string sortOrder, string searchString, string category, int?pageNumber ) { if (pageNumber == null) { currentSortOrder = sortOrder; sortOrder = string.IsNullOrEmpty(sortOrder) ? "name_desc" : string.Empty; } var menus = new MenuListViewModel { Menus = await repository.GetAllMenusAsync(currentSortOrder, searchString, category, pageNumber), Category = category, SearchString = searchString, SortOrder = sortOrder, CurrentSortOrder = currentSortOrder, }; return(View(menus)); }
public ViewResult List(string category, int page = 1) { var model = new MenuListViewModel { MenuItems = _baseDataAccess.GetMenuItems() .Where(m => category == null || m.Category.Name == category) .OrderBy(m => m.Id) .Skip((page - 1) * PageSize) .Take(PageSize), PagingInfo = new PagingInfo() { CurrentPage = page, ItemsPerPage = PageSize, TotalItems = category == null? _baseDataAccess.GetMenuItems().Count() : _baseDataAccess.GetMenuItems().Count(e => e.Category.Name == category) }, CurrentCategory = category }; ViewBag.SelectedCategory = category; return(View(model)); }
public MenuListPage() { BindingContext = new MenuListViewModel(); InitializeComponent(); Menu = lstMenu; }
public MainWindow() { InitializeComponent(); //DisplayUsersList(); var menuItems = MenuListViewModel.GenerateMenuForUser(((UserIdentity)Thread.CurrentPrincipal.Identity).UserID); LoadMenuItems(menuItems); }
public ViewResult List() { ViewBag.Title = "Страница меню"; MenuListViewModel obj = new MenuListViewModel(); obj.allMenu = _allMenu.Menus; obj.MenuCategory = "Меню"; return(View(obj)); }
void RefreshTreeList() { menuItemsBindingSource.DataSource = null; if (groupsLookUp.EditValue != null && resourceTypeLookUp.EditValue != null) { menuItemsBindingSource.DataSource = MenuListViewModel.GenerateMenuItems((int)groupsLookUp.EditValue, (int)resourceTypeLookUp.EditValue); menuItemsBindingSource.DataSource = HierarchicalCheck(menuItemsBindingSource.DataSource); RefreshReadOnlyView(); } }
public ActionResult MenuList(int?page, string qry, string target) { MenuListViewModel model = new MenuListViewModel(); model.Filter.FilterTargetStr = target; model.Filter.QueryString = qry; model.Filter.CurrentPage = page ?? 1; model.Result = this.Repository.GetMenuList(model.Filter); ViewBag.Targer = target; ViewBag.SearchStr = qry; return(View(model)); }
public async Task <IViewComponentResult> InvokeAsync(int parentId) { MenuListViewModel result = new MenuListViewModel(); var backmenu = _context.Menu.FirstOrDefault(f => f.MenuId == parentId); if (backmenu != null) { result.RootMenu = backmenu; //ViewBag.backId = backmenu.ParentId; } result.MenuList = _context.Menu.Where(w => w.ParentId == parentId).ToList(); return(View(result)); }
public PartialViewResult MenuForAdmin(SearchGoods searchGoods) { IEnumerable <CategoryModel> categories = this._categoryRepository.GetCategories(); ICollection <ClothesTypeModel> clothesTypes = this._typesRepository.GetClothesTypes(); MenuListViewModel mlvm = new MenuListViewModel { Categories = new SelectList(categories, "CategoryId", "Name"), ClothesTypes = clothesTypes, Search = searchGoods }; return(PartialView(mlvm)); }
public ActionResult Index() { MenuCategoryRepository categoryRepo = new MenuCategoryRepository(memoryCache); categoryRepo.GetAll(); MenuRepository menuRepo = new MenuRepository(applicationCache); menuRepo.GetAll(); MenuListViewModel vm = new MenuListViewModel(); vm.MenuItems = menuRepo.GetAll(); vm.MenuCategories = categoryRepo.GetAll(); return(View("~/Views/MenuItems.cshtml", vm)); }
public static MenuListViewModel GetMenuList() { var menuList = new MenuListViewModel(); using (var context = new Model.Entities.RecipeDbContext()) { foreach (var menuItem in context.MenuItems) { var menuItemViewModel = new MenuItemViewModel(menuItem); menuItemViewModel.Recipe = recipes.First(r => r.Id == menuItem.RecipeId); menuItemViewModel.Recipe.LoadDetails(); menuItemViewModel.Recipe.AddMenuItem(menuItem); menuList.Add(menuItemViewModel); } } return(menuList); }
public ActionResult List() { try { //初始化物件 var m = new MenuListViewModel(); m.Authority = Tool.GetPageAuthority(); //所有選單資料 var dtMenu = MenuDataAccess.GetAllMenuList(null); m.List = Util.ToList <ListItem>(dtMenu); return(View(m)); } catch { return(RedirectToAction("Error", "Home")); } }
public IActionResult MenuList(int page = 1) { int pageIndex = page - 1; if (pageIndex < 0) { pageIndex = 0; } Pagination pagination = new Pagination { PageIndex = pageIndex, PageSize = 5 }; MenuListViewModel vm = new MenuListViewModel { MenuList = _MenuService.GetMenuList(pagination), GetMenuFunc = _MenuService.GetMenu, PageInfo = pagination }; return(View(vm)); }
private void LogUserIn(User us) { // Now change the connection string to have the user id in the application name... ConnectionHelper.CurrentConnection.ApplicationName = string.Format("HCMIS-Warehouse-V-{0}-U-{1}", Program.HCMISVersionString, us.ID); // Re-register the connection string manager here. MyGeneration.dOOdads.BusinessEntity.RegistryConnectionString = ConnectionHelper.CurrentConnection.ToString(); ConnectionManager.ConnectionString = ConnectionHelper.CurrentConnection.ToString(); if (BLL.Settings.UseNewUserManagement) { // Idealy, this has to work, but we don't know the kind of code that depends on the legacy new main window object. var menuItems = MenuListViewModel.GenerateMenuForUser(((UserIdentity)Thread.CurrentPrincipal.Identity).UserID); MainWindow mainWindow = new MainWindow(menuItems); //Legacy Code ... Remove this when not in use. CurrentContext main = new CurrentContext(); CurrentContext.UserId = us.ID; CurrentContext.LoggedInUser = us; CurrentContext.LoggedInUserName = string.Format("{0} {1}", us.FirstName, us.LastName); if (string.IsNullOrEmpty(CurrentContext.LoggedInUserName)) { CurrentContext.LoggedInUserName = us.UserName; } mainWindow.Show(); this.Hide(); } if (!System.Diagnostics.Debugger.IsAttached) { BLL.LogLogin newLoginLog = new LoginLog(); newLoginLog.AddNew(us.ID, DateTimeHelper.ServerDateTime, true, Environment.MachineName, "", "", false, "", Program.HCMISVersionString); // Also update the last login time on the User Object } }
public IActionResult Edit(string id) { if (User.IsInRole("Vendor")) { Vendor vendor = _db._Users.Where(e => e.AspNetUser.Id.Equals(User.FindFirstValue(ClaimTypes.NameIdentifier))).FirstOrDefault().ListVendors.Where(e => e.Id.Equals(id) && e.Deleted == false).FirstOrDefault(); if (vendor == null) { return(RedirectToAction("Index", "Menu")); } else { ViewBag.Nav = 2; MenuListViewModel model = new MenuListViewModel(); model.SelectedVendor = vendor; model.Vendors = _db._Users.Where(e => e.AspNetUser.Id.Equals(User.FindFirstValue(ClaimTypes.NameIdentifier))).FirstOrDefault().ListVendors.Where(e => e.Deleted == false).OrderBy(e => e.DateCreated).ToList(); model.Menus = vendor.Menus.Where(e => e.Deleted == false).OrderBy(e => e.Name).ToList(); return(View(model)); } } else { return(RedirectToAction("Index", "Home")); } }
public MenuList(MyModel currentItem) { InitializeComponent(); BindingContext = new MenuListViewModel(currentItem); }