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(); } }
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()); } }