public IHttpActionResult ChangePassword([FromBody] JObject data) { try { int userID = !string.IsNullOrEmpty(data.SelectToken("UserID").Value <string>()) ? Convert.ToInt32(data.SelectToken("UserID").Value <string>()) : 0; string oldPassword = !string.IsNullOrEmpty(data.SelectToken("OldPassword").Value <string>()) ? data.SelectToken("OldPassword").Value <string>() : string.Empty; string newPassword = !string.IsNullOrEmpty(data.SelectToken("NewPassword").Value <string>()) ? data.SelectToken("NewPassword").Value <string>() : string.Empty; var status = manageUser.ChangePassword(userID, oldPassword, newPassword); if (status == "SUCCESS") { return(Json(new { status = true, message = "Password is changed successfully" })); } else if (status == "WOP") { return(Json(new { status = false, message = "Old password is wrong" })); } else { return(Json(new { status = false, message = "Unknown Error" })); } } catch (Exception ex) { return(Json(new { status = false, message = "Unknown error occurred" })); } }