public async Task <JsonResult> UpdateMember(string accountName, string memberName, bool isAdmin)
        {
            var account = GetAccount(accountName);

            if (account == null ||
                ActionsRequiringPermissions.ManageMembership.CheckPermissions(GetCurrentUser(), account)
                != PermissionsCheckResult.Allowed)
            {
                return(Json(HttpStatusCode.Forbidden, Strings.Unauthorized));
            }

            if (!account.Confirmed)
            {
                return(Json(HttpStatusCode.BadRequest, Strings.Member_OrganizationUnconfirmed));
            }

            try
            {
                var membership = await UserService.UpdateMemberAsync(account, memberName, isAdmin);

                MessageService.SendOrganizationMemberUpdatedNotice(account, membership);

                return(Json(new OrganizationMemberViewModel(membership)));
            }
            catch (EntityException e)
            {
                return(Json(HttpStatusCode.BadRequest, e.Message));
            }
        }
        public async Task <ActionResult> ConfirmMemberRequest(string accountName, string confirmationToken)
        {
            var account = GetAccount(accountName);

            if (account == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.NotFound));
            }

            try
            {
                var member = await UserService.AddMemberAsync(account, GetCurrentUser().Username, confirmationToken);

                MessageService.SendOrganizationMemberUpdatedNotice(account, member);

                TempData["Message"] = String.Format(CultureInfo.CurrentCulture,
                                                    Strings.AddMember_Success, account.Username);

                return(Redirect(Url.ManageMyOrganization(account.Username)));
            }
            catch (EntityException e)
            {
                var failureReason = e.AsUserSafeException().GetUserSafeMessage();
                return(HandleOrganizationMembershipRequestView(new HandleOrganizationMembershipRequestModel(true, account, failureReason)));
            }
        }