示例#1
0
 /// <summary>
 /// Checks errors of given <see cref="IdentityResult"/> and throws <see cref="UserFriendlyException"/> if it's not succeeded.
 /// </summary>
 /// <param name="identityResult">Identity result to check</param>
 /// <param name="localizationManager">Localization manager to localize error messages</param>
 public static void CheckErrors(this IdentityResult identityResult, ILocalizationManager localizationManager)
 {
     if (identityResult.Succeeded)
     {
         return;
     }
     throw new UserFriendlyException(identityResult.LocalizeErrors(localizationManager));
 }
示例#2
0
        /// <summary>
        /// Checks errors of given <see cref="IdentityResult"/> and throws <see cref="UserFriendlyException"/> if it's not succeeded.
        /// </summary>
        /// <param name="identityResult">Identity result to check</param>
        /// <param name="localizationManager">Localization manager to localize error messages</param>
        public static void CheckErrors(this IdentityResult identityResult, string error)
        {
            if (identityResult.Succeeded)
            {
                return;
            }

            throw new Exception(identityResult.LocalizeErrors(error));
        }