AW.Webapi.Sample.Controllers.AccountController.GetErrorResult C# (CSharp) Метод

GetErrorResult() приватный Метод

private GetErrorResult ( Microsoft.AspNet.Identity.IdentityResult result ) : IHttpActionResult
result Microsoft.AspNet.Identity.IdentityResult
Результат IHttpActionResult
        private IHttpActionResult GetErrorResult(IdentityResult result)
        {
            if (result == null)
            {
                return InternalServerError();
            }

            if (!result.Succeeded)
            {
                if (result.Errors != null)
                {
                    foreach (string error in result.Errors)
                    {
                        ModelState.AddModelError("", error);
                    }
                }

                if (ModelState.IsValid)
                {
                    // 没有可发送的 ModelState 错误,因此仅返回空 BadRequest。
                    return BadRequest();
                }

                return BadRequest(ModelState);
            }

            return null;
        }