/// <summary> /// Deletes the page. /// </summary> /// <param name="blogId"> /// The blog id. /// </param> /// <param name="pageId"> /// The page id. /// </param> /// <param name="userName"> /// The user name. /// </param> /// <param name="password"> /// The password. /// </param> /// <returns> /// The delete page. /// </returns> /// <exception cref="MetaWeblogException"> /// </exception> internal async Task <bool> DeletePage(string blogId, string pageId, string userName, string password) { try { var user = GetVerifyUserAsync(userName, password); if (user == null) { throw new MetaWeblogException("11", "User authentication failed"); } //if (!_permissionChecker.IsValid(user, PermissionKeys.PageDelete)) //{ // throw new MetaWeblogException("11", "User authentication failed"); //} await _pageManager.DeleteByIdAsync(pageId); } catch (Exception ex) { throw new MetaWeblogException("15", $"DeletePage failed. Error: {ex.Message}"); } return(true); }
public async Task <IActionResult> Deletes(params string[] itemId) { if (itemId == null || itemId.Length == 0) { AlertError("没有选择。"); } else { foreach (var item in itemId) { await _pageManager.DeleteByIdAsync(item); } AlertSuccess("已删除。"); } return(RedirectToAction(nameof(List))); }