public static ResultErrorCollection ToResultErrorCollection(this List <ValidationFailure> failures)
        {
            ResultErrorCollection collection = new ResultErrorCollection();

            foreach (ValidationFailure failure in failures)
            {
                collection.Add(failure.PropertyName, failure.ErrorMessage);
            }

            return(collection);
        }
Esempio n. 2
0
        private CommonResult AddUserErrorResult(IdentityResult addUserResult, Guid messageId)
        {
            var errors = new ResultErrorCollection();

            foreach (IdentityError error in addUserResult.Errors)
            {
                errors.Add(error.Code, error.Description);
            }

            CommonResult result = new CommonResult(
                messageId: messageId,
                outcome: Outcome.ExecutionFailure,
                flashMessage: "RegisterLocalUser command execution failed.",
                errors: errors
                );

            result.LogCommonResultError("User registration error", this.GetType(), _logger);

            return(result);
        }