Esempio n. 1
0
        public ActionResult DeleteItem(int id)
        {
            var isAjax = Request.IsAjaxRequest();

            if (!Services.Permissions.Authorize(StandardPermissionProvider.ManageMenus))
            {
                return(isAjax ? new EmptyResult() : AccessDeniedView());
            }

            var item = _menuStorage.GetMenuItemById(id);

            if (item == null)
            {
                if (isAjax)
                {
                    return(new EmptyResult());
                }

                return(HttpNotFound());
            }

            var menuId = item.MenuId;

            _menuStorage.DeleteMenuItem(item);

            NotifySuccess(T("Admin.Common.TaskSuccessfullyProcessed"));

            return(RedirectToAction(isAjax ? "ItemList" : "Edit", new { id = menuId }));
        }
        public ActionResult DeleteItem(int id)
        {
            var isAjax = Request.IsAjaxRequest();

            var item = _menuStorage.GetMenuItemById(id);

            if (item == null)
            {
                if (isAjax)
                {
                    return(new EmptyResult());
                }

                return(HttpNotFound());
            }

            var menuId = item.MenuId;

            _menuStorage.DeleteMenuItem(item);

            NotifySuccess(T("Admin.Common.TaskSuccessfullyProcessed"));

            return(RedirectToAction(isAjax ? "ItemList" : "Edit", new { id = menuId }));
        }