示例#1
0
        public ActionResult UnlockUser(AHP.Core.DTO.ExternalUserInfo userInfo)
        {
            GenericAjaxResponse <bool> response = new GenericAjaxResponse <bool>();

            try
            {
                if (string.IsNullOrEmpty(userInfo.Username))
                {
                    response.Success = false;
                    response.Errors.Add("Username is required");
                    return(Json(response));
                }

                if (string.IsNullOrEmpty(userInfo.Email))
                {
                    response.Success = false;
                    response.Errors.Add("Email is required");
                    return(Json(response));
                }

                response = _restClient.UnlockUserAccount(userInfo.Username, userInfo.Email);

                if (response == null)
                {
                    response         = new GenericAjaxResponse <bool>();
                    response.Success = false;
                    response.Errors.Add("An error occurred. Please try again.");
                }
            }
            catch (Exception ex)
            {
                response.Success = false;
                response.Errors.Add("Error occurred. Please try again");
            }
            return(Json(response));
        }