/// <summary>
        /// Get all external associated Logins for User
        /// </summary>
        /// <param name="request">Instance of GetLoginsRequest</param>
        /// <returns>Instance of GetLoginsResponse</returns>
        public GetLoginsResponse GetLogins(GetLoginsRequest request)
        {
            GetLoginsResponse response = new GetLoginsResponse();

            try
            {
                IList <UserLoginInfo> result = UserManager.GetLogins(request.UserId.ToString());
                response.LinkedAccounts = result.ConvertToLoginViewList();
                response.Success        = true;
            }
            catch (Exception e)
            {
                response.Success = false;
                response.Errors.Add(e.Message);
            }

            return(response);
        }
Ejemplo n.º 2
0
        public ActionResult RemoveAccountList()
        {
            GetLoginsResponse response = this.Membership.GetLogins(new GetLoginsRequest()
            {
                UserId = new Guid(User.Identity.GetUserId())
            });

            if (response.Success)
            {
                ViewBag.ShowRemoveButton = this.HasPassword() || response.LinkedAccounts.Count > 1;

                return((ActionResult)PartialView("_RemoveAccountPartial", response.LinkedAccounts.ConvertToUserLoginInfoList()));
            }
            else
            {
                AddErrors(response.Errors);
                return(null);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Get all external associated Logins for User Async
        /// </summary>
        /// <param name="request">Instance of GetLoginsRequest</param>
        /// <returns>Instance of GetLoginsResponse</returns>
        public async Task<GetLoginsResponse> GetLoginsAsync(GetLoginsRequest request)
        {
            GetLoginsResponse response = new GetLoginsResponse();

            try
            {
                IList<UserLoginInfo> result = await UserManager.GetLoginsAsync(request.UserId.ToString());
                response.LinkedAccounts = result.ConvertToLoginViewList();
                response.Success = true;
            }
            catch (Exception e)
            {
                response.Success = false;
                response.Errors.Add(e.Message);
            }

            return response;
        }