コード例 #1
0
        public HttpResponseMessage PutPasswordChange(string token, [FromBody] JObject passwordChange)
        {
            if (passwordChange == null || !passwordChange.ContainsKey("passwordChange") || passwordChange.GetValue("passwordChange").ToString().IsEmpty())
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest));
            }

            int result = AuthUser.ChangePassword(token, passwordChange.GetValue("passwordChange").ToString());

            if (result == -2)
            {
                return(Request.CreateResponse(HttpStatusCode.NotFound));
            }
            else if (result == -1)
            {
                return(Request.CreateResponse(HttpStatusCode.NotFound));
            }
            else if (result == 0)
            {
                return(Request.CreateResponse(HttpStatusCode.InternalServerError));
            }

            else
            {
                return(Request.CreateResponse(HttpStatusCode.Created));
            }
        }