예제 #1
0
        public void OnGet(int id)
        {
            var menuItem = _menuItemsService.GetById(id);

            if (menuItem == null)
            {
                ErrorMessage = $"There is no menu item with ID: {id}";
            }
            else
            {
                MenuItem = menuItem.ToMenuItemView();
            }
        }
예제 #2
0
        public IActionResult OnGetDelete(int id)
        {
            var menuItem = _menuItemsService.GetById(id);

            if (menuItem == null)
            {
                Message = "There is no item with such Id";
                OnGet();
                return(Page());
            }
            else
            {
                _menuItemsService.Delete(menuItem);
                OnGet();
                return(Page());
            }
        }