public JsonResult UnblockUser(string blockedUID) { GenericResponse result = new GenericResponse() { IsSuccessful = false }; try { if (blockedUID.IsNullOrWhitespace()) { result.ErrorMessage = "Bad request."; return(new JsonResult(result)); } // Retrieve the requested user User blocked = _userService.GetUserByUID(blockedUID); if (blocked != null && BlockedUserPermissionHelper.CanUnblockUser(_blockedUserService, _context.CurrentUser, blocked)) { // Ublock the user _blockedUserService.UnblockUser(_context.CurrentUser, blocked); // If we got this far we're successful result.IsSuccessful = true; } else { result.ErrorMessage = "You do not have permission to unblock this user."; } } catch (Exception e) { result.ErrorMessage = "An exception occurred."; _exceptionService.ReportException(e); } return(new JsonResult(result)); }