public HttpResponseMessage Post(ChangePasswordDTO request) { HttpResponseMessage responseMessage = null; JSendMessage json; if (request.Password != null) { var token = Request.Headers.SingleOrDefault(x => x.Key == "token").Value.First(); var updated = users.ChangePassword(token, request.Password); if (!updated) { responseMessage = Request.CreateResponse(HttpStatusCode.BadRequest); } else { json = new JSendMessage("success", "Your password has been successfully changed"); responseMessage = Request.CreateResponse(HttpStatusCode.OK, json); } } return(responseMessage); }