Пример #1
0
        public async Task <IActionResult> DeleteConfirmed(Guid id)
        {
            string root = _hostEnv.WebRootPath;
            var    mI   = await _service.GetFullMenuItem(id);

            var res = await _service.DeleteAsync(root, mI);

            return(RedirectToAction(nameof(Index)));
        }
Пример #2
0
        public async Task <ActionResult> Delete(int menuItemId)
        {
            var menuItem = await _menuItemService.GetAsync(menuItemId);

            var menuId = menuItem.MenuId;

            await _menuItemService.DeleteAsync(menuItemId);

            await ResetSessionMenuAsync(menuId);

            return(Redirect(HttpContext.Request.UrlReferrer.ToString()));
        }
Пример #3
0
        public async Task <JsonResult> DeleteItem([FromBody] int menuItemId)
        {
            var menuItem = await _menuItemService.GetAsync(menuItemId);

            if (menuItem == null)
            {
                return(AjaxHelper.JsonResult(HttpStatusCode.NotFound, "该菜单项不存在"));
            }
            string token         = HttpContext.Request.Headers["token"];
            var    currentUserId = (await LoginManager.GetUserIdAsync(token)).GetValueOrDefault();

            menuItem.DeleterUserId = currentUserId;
            menuItem.DeletionTime  = DateTime.Now;
            await _menuItemService.DeleteAsync(menuItem);

            return(AjaxHelper.JsonResult(HttpStatusCode.OK, "删除成功"));
        }
Пример #4
0
 public async Task <IActionResult> Delete(int id)
 {
     return(await DeleteAsync(
                async() => await _menuItemService.MenuItemExistsAsync(id),
                async() => await _menuItemService.DeleteAsync(id)));
 }
 public Task <ServiceResult> Delete(Guid id)
 {
     return(_menuItemService.DeleteAsync(id));
 }