public async Task <JsonResult> OnPostDestroyUser([DataSourceRequest] DataSourceRequest request, User user) { try { var userForDelete = _users.First(x => x.UserId == user.UserId); _users.Remove(userForDelete); var objForDelete = await _uow.Users.GetAsync(user.UserId); // Удаляем из кэша await _uow.Users.DeleteAsync(objForDelete); await _uow.SaveChangesAsync(); // Производим удаление из mongodb await _usersStorageService.DeleteUserAsync(objForDelete); // Удаляем индексы из таблиц UserPermissions и PermissionUsers await _permissionsService.DeleteRemainingIndicesForUserAsync(objForDelete); //await PopulateDropDownListsAsync(); } catch (Exception e) { _logger.LogWarning($"--- OnPostDestroyUser something wrong.\n\n Reason: {e.Message}"); _logger.LogDebug(3000, e, "------------------------------------------------------"); } return(new JsonResult(new[] { user }.ToDataSourceResult(request, ModelState))); }